clang  19.0.0git
Sema.h
Go to the documentation of this file.
1 //===--- Sema.h - Semantic Analysis & AST Building --------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the Sema class, which performs semantic analysis and
10 // builds ASTs.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_SEMA_SEMA_H
15 #define LLVM_CLANG_SEMA_SEMA_H
16 
18 #include "clang/AST/ASTConcept.h"
19 #include "clang/AST/ASTFwd.h"
20 #include "clang/AST/Attr.h"
21 #include "clang/AST/Availability.h"
23 #include "clang/AST/DeclTemplate.h"
25 #include "clang/AST/Expr.h"
26 #include "clang/AST/ExprCXX.h"
27 #include "clang/AST/ExprConcepts.h"
28 #include "clang/AST/ExprObjC.h"
30 #include "clang/AST/LocInfoType.h"
32 #include "clang/AST/NSAPI.h"
34 #include "clang/AST/StmtCXX.h"
35 #include "clang/AST/TypeLoc.h"
36 #include "clang/AST/TypeOrdering.h"
38 #include "clang/Basic/Builtins.h"
39 #include "clang/Basic/Cuda.h"
43 #include "clang/Basic/Module.h"
46 #include "clang/Basic/Specifiers.h"
48 #include "clang/Basic/TypeTraits.h"
50 #include "clang/Sema/CleanupInfo.h"
51 #include "clang/Sema/DeclSpec.h"
55 #include "clang/Sema/Ownership.h"
57 #include "clang/Sema/Scope.h"
58 #include "clang/Sema/SemaBase.h"
59 #include "clang/Sema/SemaConcept.h"
62 #include "clang/Sema/Weak.h"
63 #include "llvm/ADT/ArrayRef.h"
64 #include "llvm/ADT/STLForwardCompat.h"
65 #include "llvm/ADT/SetVector.h"
66 #include "llvm/ADT/SmallBitVector.h"
67 #include "llvm/ADT/SmallPtrSet.h"
68 #include "llvm/ADT/SmallSet.h"
69 #include "llvm/ADT/SmallVector.h"
70 #include "llvm/ADT/TinyPtrVector.h"
71 #include <deque>
72 #include <memory>
73 #include <optional>
74 #include <string>
75 #include <tuple>
76 #include <vector>
77 
78 namespace llvm {
79 class APSInt;
80 template <typename ValueT, typename ValueInfoT> class DenseSet;
81 class SmallBitVector;
82 struct InlineAsmIdentifierInfo;
83 } // namespace llvm
84 
85 namespace clang {
86 class ADLResult;
87 class ASTConsumer;
88 class ASTContext;
89 class ASTMutationListener;
90 class ASTReader;
91 class ASTWriter;
92 class ArrayType;
93 class ParsedAttr;
94 class BindingDecl;
95 class BlockDecl;
96 class CapturedDecl;
97 class CXXBasePath;
98 class CXXBasePaths;
99 class CXXBindTemporaryExpr;
101 class CXXConstructorDecl;
102 class CXXConversionDecl;
103 class CXXDeleteExpr;
104 class CXXDestructorDecl;
105 class CXXFieldCollector;
106 class CXXMemberCallExpr;
107 class CXXMethodDecl;
108 class CXXScopeSpec;
109 class CXXTemporary;
110 class CXXTryStmt;
111 class CallExpr;
112 class ClassTemplateDecl;
113 class ClassTemplatePartialSpecializationDecl;
114 class ClassTemplateSpecializationDecl;
115 class VarTemplatePartialSpecializationDecl;
116 class CodeCompleteConsumer;
117 class CodeCompletionAllocator;
118 class CodeCompletionTUInfo;
119 class CodeCompletionResult;
120 class CoroutineBodyStmt;
121 class Decl;
122 class DeclAccessPair;
123 class DeclContext;
124 class DeclRefExpr;
125 class DeclaratorDecl;
126 class DeducedTemplateArgument;
127 class DependentDiagnostic;
128 class DesignatedInitExpr;
129 class Designation;
130 class EnableIfAttr;
131 class EnumConstantDecl;
132 class Expr;
133 class ExtVectorType;
134 class FormatAttr;
135 class FriendDecl;
136 class FunctionDecl;
137 class FunctionProtoType;
138 class FunctionTemplateDecl;
139 class ImplicitConversionSequence;
141 class InitListExpr;
142 class InitializationKind;
143 class InitializationSequence;
144 class InitializedEntity;
145 class IntegerLiteral;
146 class LabelStmt;
147 class LambdaExpr;
148 class LangOptions;
149 class LocalInstantiationScope;
150 class LookupResult;
151 class MacroInfo;
153 class ModuleLoader;
154 class MultiLevelTemplateArgumentList;
155 class NamedDecl;
156 class ObjCCategoryDecl;
157 class ObjCCategoryImplDecl;
158 class ObjCCompatibleAliasDecl;
159 class ObjCContainerDecl;
160 class ObjCImplDecl;
161 class ObjCImplementationDecl;
162 class ObjCInterfaceDecl;
163 class ObjCIvarDecl;
164 template <class T> class ObjCList;
165 class ObjCMessageExpr;
166 class ObjCMethodDecl;
167 class ObjCPropertyDecl;
168 class ObjCProtocolDecl;
169 struct OverloadCandidate;
170 enum class OverloadCandidateParamOrder : char;
172 class OverloadCandidateSet;
173 class OverloadExpr;
174 class ParenListExpr;
175 class ParmVarDecl;
176 class Preprocessor;
177 class PseudoDestructorTypeStorage;
178 class PseudoObjectExpr;
179 class QualType;
180 class SemaCUDA;
181 class SemaHLSL;
182 class SemaOpenACC;
183 class SemaOpenMP;
184 class SemaSYCL;
185 class StandardConversionSequence;
186 class Stmt;
187 class StringLiteral;
188 class SwitchStmt;
189 class TemplateArgument;
190 class TemplateArgumentList;
191 class TemplateArgumentLoc;
192 class TemplateDecl;
193 class TemplateInstantiationCallback;
194 class TemplateParameterList;
195 class TemplatePartialOrderingContext;
196 class TemplateTemplateParmDecl;
197 class Token;
198 class TypeAliasDecl;
199 class TypedefDecl;
200 class TypedefNameDecl;
201 class TypeLoc;
202 class TypoCorrectionConsumer;
203 class UnqualifiedId;
204 class UnresolvedLookupExpr;
205 class UnresolvedMemberExpr;
206 class UnresolvedSetImpl;
207 class UnresolvedSetIterator;
208 class UsingDecl;
209 class UsingShadowDecl;
210 class ValueDecl;
211 class VarDecl;
212 class VarTemplateSpecializationDecl;
213 class VisibilityAttr;
214 class VisibleDeclConsumer;
215 class IndirectFieldDecl;
216 struct DeductionFailureInfo;
217 class TemplateSpecCandidateSet;
218 
219 namespace sema {
220 class AccessedEntity;
221 class BlockScopeInfo;
222 class Capture;
223 class CapturedRegionScopeInfo;
224 class CapturingScopeInfo;
225 class CompoundScopeInfo;
226 class DelayedDiagnostic;
227 class DelayedDiagnosticPool;
228 class FunctionScopeInfo;
229 class LambdaScopeInfo;
230 class PossiblyUnreachableDiag;
231 class RISCVIntrinsicManager;
232 class SemaPPCallbacks;
233 class TemplateDeductionInfo;
234 } // namespace sema
235 
236 namespace threadSafety {
237 class BeforeSet;
238 void threadSafetyCleanup(BeforeSet *Cache);
239 } // namespace threadSafety
240 
241 // FIXME: No way to easily map from TemplateTypeParmTypes to
242 // TemplateTypeParmDecls, so we have this horrible PointerUnion.
243 typedef std::pair<llvm::PointerUnion<const TemplateTypeParmType *, NamedDecl *>,
244  SourceLocation>
246 
247 /// Describes whether we've seen any nullability information for the given
248 /// file.
250  /// The first pointer declarator (of any pointer kind) in the file that does
251  /// not have a corresponding nullability annotation.
253 
254  /// The end location for the first pointer declarator in the file. Used for
255  /// placing fix-its.
257 
258  /// Which kind of pointer declarator we saw.
259  uint8_t PointerKind;
260 
261  /// Whether we saw any type nullability annotations in the given file.
262  bool SawTypeNullability = false;
263 };
264 
265 /// A mapping from file IDs to a record of whether we've seen nullability
266 /// information in that file.
268  /// A mapping from file IDs to the nullability information for each file ID.
269  llvm::DenseMap<FileID, FileNullability> Map;
270 
271  /// A single-element cache based on the file ID.
272  struct {
275  } Cache;
276 
277 public:
279  // Check the single-element cache.
280  if (file == Cache.File)
281  return Cache.Nullability;
282 
283  // It's not in the single-element cache; flush the cache if we have one.
284  if (!Cache.File.isInvalid()) {
285  Map[Cache.File] = Cache.Nullability;
286  }
287 
288  // Pull this entry into the cache.
289  Cache.File = file;
290  Cache.Nullability = Map[file];
291  return Cache.Nullability;
292  }
293 };
294 
295 /// Tracks expected type during expression parsing, for use in code completion.
296 /// The type is tied to a particular token, all functions that update or consume
297 /// the type take a start location of the token they are looking at as a
298 /// parameter. This avoids updating the type on hot paths in the parser.
300 public:
301  PreferredTypeBuilder(bool Enabled) : Enabled(Enabled) {}
302 
303  void enterCondition(Sema &S, SourceLocation Tok);
304  void enterReturn(Sema &S, SourceLocation Tok);
305  void enterVariableInit(SourceLocation Tok, Decl *D);
306  /// Handles e.g. BaseType{ .D = Tok...
308  const Designation &D);
309  /// Computing a type for the function argument may require running
310  /// overloading, so we postpone its computation until it is actually needed.
311  ///
312  /// Clients should be very careful when using this function, as it stores a
313  /// function_ref, clients should make sure all calls to get() with the same
314  /// location happen while function_ref is alive.
315  ///
316  /// The callback should also emit signature help as a side-effect, but only
317  /// if the completion point has been reached.
319  llvm::function_ref<QualType()> ComputeType);
320 
321  void enterParenExpr(SourceLocation Tok, SourceLocation LParLoc);
322  void enterUnary(Sema &S, SourceLocation Tok, tok::TokenKind OpKind,
323  SourceLocation OpLoc);
324  void enterBinary(Sema &S, SourceLocation Tok, Expr *LHS, tok::TokenKind Op);
325  void enterMemAccess(Sema &S, SourceLocation Tok, Expr *Base);
326  void enterSubscript(Sema &S, SourceLocation Tok, Expr *LHS);
327  /// Handles all type casts, including C-style cast, C++ casts, etc.
329 
330  /// Get the expected type associated with this location, if any.
331  ///
332  /// If the location is a function argument, determining the expected type
333  /// involves considering all function overloads and the arguments so far.
334  /// In this case, signature help for these function overloads will be reported
335  /// as a side-effect (only if the completion point has been reached).
337  if (!Enabled || Tok != ExpectedLoc)
338  return QualType();
339  if (!Type.isNull())
340  return Type;
341  if (ComputeType)
342  return ComputeType();
343  return QualType();
344  }
345 
346 private:
347  bool Enabled;
348  /// Start position of a token for which we store expected type.
349  SourceLocation ExpectedLoc;
350  /// Expected type for a token starting at ExpectedLoc.
351  QualType Type;
352  /// A function to compute expected type at ExpectedLoc. It is only considered
353  /// if Type is null.
354  llvm::function_ref<QualType()> ComputeType;
355 };
356 
357 struct SkipBodyInfo {
358  SkipBodyInfo() = default;
359  bool ShouldSkip = false;
360  bool CheckSameAsPrevious = false;
361  NamedDecl *Previous = nullptr;
362  NamedDecl *New = nullptr;
363 };
364 
365 /// Describes the result of template argument deduction.
366 ///
367 /// The TemplateDeductionResult enumeration describes the result of
368 /// template argument deduction, as returned from
369 /// DeduceTemplateArguments(). The separate TemplateDeductionInfo
370 /// structure provides additional information about the results of
371 /// template argument deduction, e.g., the deduced template argument
372 /// list (if successful) or the specific template parameters or
373 /// deduced arguments that were involved in the failure.
375  /// Template argument deduction was successful.
376  Success = 0,
377  /// The declaration was invalid; do nothing.
378  Invalid,
379  /// Template argument deduction exceeded the maximum template
380  /// instantiation depth (which has already been diagnosed).
382  /// Template argument deduction did not deduce a value
383  /// for every template parameter.
384  Incomplete,
385  /// Template argument deduction did not deduce a value for every
386  /// expansion of an expanded template parameter pack.
388  /// Template argument deduction produced inconsistent
389  /// deduced values for the given template parameter.
390  Inconsistent,
391  /// Template argument deduction failed due to inconsistent
392  /// cv-qualifiers on a template parameter type that would
393  /// otherwise be deduced, e.g., we tried to deduce T in "const T"
394  /// but were given a non-const "X".
396  /// Substitution of the deduced template argument values
397  /// resulted in an error.
399  /// After substituting deduced template arguments, a dependent
400  /// parameter type did not match the corresponding argument.
402  /// After substituting deduced template arguments, an element of
403  /// a dependent parameter type did not match the corresponding element
404  /// of the corresponding argument (when deducing from an initializer list).
406  /// A non-depnedent component of the parameter did not match the
407  /// corresponding component of the argument.
409  /// When performing template argument deduction for a function
410  /// template, there were too many call arguments.
412  /// When performing template argument deduction for a function
413  /// template, there were too few call arguments.
415  /// The explicitly-specified template arguments were not valid
416  /// template arguments for the given template.
418  /// Checking non-dependent argument conversions failed.
420  /// The deduced arguments did not satisfy the constraints associated
421  /// with the template.
423  /// Deduction failed; that's all we know.
425  /// CUDA Target attributes do not match.
427  /// Some error which was already diagnosed.
429 };
430 
431 /// Kinds of C++ special members.
438  Destructor,
439  Invalid
440 };
441 
442 /// The kind of conversion being performed.
444  /// An implicit conversion.
445  Implicit,
446  /// A C-style cast.
447  CStyleCast,
448  /// A functional-style cast.
450  /// A cast other than a C-style cast.
451  OtherCast,
452  /// A conversion for an operand of a builtin overloaded operator.
454 };
455 
456 /// Sema - This implements semantic analysis and AST building for C.
457 /// \nosubgrouping
458 class Sema final : public SemaBase {
459  // Table of Contents
460  // -----------------
461  // 1. Semantic Analysis (Sema.cpp)
462  // 2. C++ Access Control (SemaAccess.cpp)
463  // 3. Attributes (SemaAttr.cpp)
464  // 4. Availability Attribute Handling (SemaAvailability.cpp)
465  // 5. Casts (SemaCast.cpp)
466  // 6. Extra Semantic Checking (SemaChecking.cpp)
467  // 7. C++ Coroutines (SemaCoroutine.cpp)
468  // 8. C++ Scope Specifiers (SemaCXXScopeSpec.cpp)
469  // 9. Declarations (SemaDecl.cpp)
470  // 10. Declaration Attribute Handling (SemaDeclAttr.cpp)
471  // 11. C++ Declarations (SemaDeclCXX.cpp)
472  // 12. C++ Exception Specifications (SemaExceptionSpec.cpp)
473  // 13. Expressions (SemaExpr.cpp)
474  // 14. C++ Expressions (SemaExprCXX.cpp)
475  // 15. Member Access Expressions (SemaExprMember.cpp)
476  // 16. Initializers (SemaInit.cpp)
477  // 17. C++ Lambda Expressions (SemaLambda.cpp)
478  // 18. Name Lookup (SemaLookup.cpp)
479  // 19. Modules (SemaModule.cpp)
480  // 20. C++ Overloading (SemaOverload.cpp)
481  // 21. Pseudo-Object (SemaPseudoObject.cpp)
482  // 22. Statements (SemaStmt.cpp)
483  // 23. `inline asm` Statement (SemaStmtAsm.cpp)
484  // 24. Statement Attribute Handling (SemaStmtAttr.cpp)
485  // 25. C++ Templates (SemaTemplate.cpp)
486  // 26. C++ Template Argument Deduction (SemaTemplateDeduction.cpp)
487  // 27. C++ Template Instantiation (SemaTemplateInstantiate.cpp)
488  // 28. C++ Template Declaration Instantiation
489  // (SemaTemplateInstantiateDecl.cpp)
490  // 29. C++ Variadic Templates (SemaTemplateVariadic.cpp)
491  // 30. Constraints and Concepts (SemaConcept.cpp)
492  // 31. Types (SemaType.cpp)
493  // 32. ObjC Declarations (SemaDeclObjC.cpp)
494  // 33. ObjC Expressions (SemaExprObjC.cpp)
495  // 34. ObjC @property and @synthesize (SemaObjCProperty.cpp)
496  // 35. Code Completion (SemaCodeComplete.cpp)
497  // 36. FixIt Helpers (SemaFixItUtils.cpp)
498  // 37. Name Lookup for RISC-V Vector Intrinsic (SemaRISCVVectorLookup.cpp)
499 
500  /// \name Semantic Analysis
501  /// Implementations are in Sema.cpp
502  ///@{
503 
504 public:
505  Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
507  CodeCompleteConsumer *CompletionConsumer = nullptr);
508  ~Sema();
509 
510  /// Perform initialization that occurs after the parser has been
511  /// initialized but before it parses anything.
512  void Initialize();
513 
514  /// This virtual key function only exists to limit the emission of debug info
515  /// describing the Sema class. GCC and Clang only emit debug info for a class
516  /// with a vtable when the vtable is emitted. Sema is final and not
517  /// polymorphic, but the debug info size savings are so significant that it is
518  /// worth adding a vtable just to take advantage of this optimization.
519  virtual void anchor();
520 
521  const LangOptions &getLangOpts() const { return LangOpts; }
524 
527  Preprocessor &getPreprocessor() const { return PP; }
528  ASTContext &getASTContext() const { return Context; }
529  ASTConsumer &getASTConsumer() const { return Consumer; }
532 
534  StringRef Platform);
536 
537  /// Registers an external source. If an external source already exists,
538  /// creates a multiplex external source and appends to it.
539  ///
540  ///\param[in] E - A non-null external sema source.
541  ///
543 
544  void PrintStats() const;
545 
546  /// Warn that the stack is nearly exhausted.
548 
549  /// Run some code with "sufficient" stack space. (Currently, at least 256K is
550  /// guaranteed). Produces a warning if we're low on stack space and allocates
551  /// more in that case. Use this in code that may recurse deeply (for example,
552  /// in template instantiation) to avoid stack overflow.
554  llvm::function_ref<void()> Fn);
555 
556  /// Returns default addr space for method qualifiers.
558 
559  /// Load weak undeclared identifiers from the external source.
561 
562  /// Determine if VD, which must be a variable or function, is an external
563  /// symbol that nonetheless can't be referenced from outside this translation
564  /// unit because its type has no linkage and it's not extern "C".
565  bool isExternalWithNoLinkageType(const ValueDecl *VD) const;
566 
567  /// Obtain a sorted list of functions that are undefined but ODR-used.
568  void getUndefinedButUsed(
569  SmallVectorImpl<std::pair<NamedDecl *, SourceLocation>> &Undefined);
570 
571  typedef std::pair<SourceLocation, bool> DeleteExprLoc;
573  /// Retrieves list of suspicious delete-expressions that will be checked at
574  /// the end of translation unit.
575  const llvm::MapVector<FieldDecl *, DeleteLocs> &
577 
578  /// Cause the active diagnostic on the DiagosticsEngine to be
579  /// emitted. This is closely coupled to the SemaDiagnosticBuilder class and
580  /// should not be used elsewhere.
581  void EmitCurrentDiagnostic(unsigned DiagID);
582 
583  void addImplicitTypedef(StringRef Name, QualType T);
584 
585  /// Whether uncompilable error has occurred. This includes error happens
586  /// in deferred diagnostics.
587  bool hasUncompilableErrorOccurred() const;
588 
589  bool findMacroSpelling(SourceLocation &loc, StringRef name);
590 
591  /// Calls \c Lexer::getLocForEndOfToken()
593 
594  /// Retrieve the module loader associated with the preprocessor.
595  ModuleLoader &getModuleLoader() const;
596 
597  /// Invent a new identifier for parameters of abbreviated templates.
600  unsigned Index);
601 
603 
604  // Emit all deferred diagnostics.
605  void emitDeferredDiags();
606 
608  /// The global module fragment, between 'module;' and a module-declaration.
610  /// A normal translation unit fragment. For a non-module unit, this is the
611  /// entire translation unit. Otherwise, it runs from the module-declaration
612  /// to the private-module-fragment (if any) or the end of the TU (if not).
614  /// The private module fragment, between 'module :private;' and the end of
615  /// the translation unit.
616  Private
617  };
618 
622 
624 
625  void PushFunctionScope();
626  void PushBlockScope(Scope *BlockScope, BlockDecl *Block);
628 
629  /// This is used to inform Sema what the current TemplateParameterDepth
630  /// is during Parsing. Currently it is used to pass on the depth
631  /// when parsing generic lambda 'auto' parameters.
633 
634  void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD,
636  unsigned OpenMPCaptureLevel = 0);
637 
638  /// Custom deleter to allow FunctionScopeInfos to be kept alive for a short
639  /// time after they've been popped.
641  Sema *Self;
642 
643  public:
644  explicit PoppedFunctionScopeDeleter(Sema *Self) : Self(Self) {}
646  };
647 
649  std::unique_ptr<sema::FunctionScopeInfo, PoppedFunctionScopeDeleter>;
650 
653  const Decl *D = nullptr,
654  QualType BlockType = QualType());
655 
657 
661  void setFunctionHasMustTail();
662 
663  void PushCompoundScope(bool IsStmtExpr);
664  void PopCompoundScope();
665 
667 
668  /// Retrieve the current block, if any.
670 
671  /// Get the innermost lambda enclosing the current location, if any. This
672  /// looks through intervening non-lambda scopes such as local functions and
673  /// blocks.
675 
676  /// Retrieve the current lambda scope info, if any.
677  /// \param IgnoreNonLambdaCapturingScope true if should find the top-most
678  /// lambda scope info ignoring all inner capturing scopes that are not
679  /// lambda scopes.
681  getCurLambda(bool IgnoreNonLambdaCapturingScope = false);
682 
683  /// Retrieve the current generic lambda info, if any.
685 
686  /// Retrieve the current captured region, if any.
688 
689  void ActOnComment(SourceRange Comment);
690 
691  /// Retrieve the parser's current scope.
692  ///
693  /// This routine must only be used when it is certain that semantic analysis
694  /// and the parser are in precisely the same context, which is not the case
695  /// when, e.g., we are performing any kind of template instantiation.
696  /// Therefore, the only safe places to use this scope are in the parser
697  /// itself and in routines directly invoked from the parser and *never* from
698  /// template substitution or instantiation.
699  Scope *getCurScope() const { return CurScope; }
700 
702 
705  }
706 
707  SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID,
708  const FunctionDecl *FD = nullptr);
710  const PartialDiagnostic &PD,
711  const FunctionDecl *FD = nullptr) {
712  return targetDiag(Loc, PD.getDiagID(), FD) << PD;
713  }
714 
715  /// Check if the type is allowed to be used for the current target.
717  ValueDecl *D = nullptr);
718 
719  // /// The kind of conversion being performed.
720  // enum CheckedConversionKind {
721  // /// An implicit conversion.
722  // CCK_ImplicitConversion,
723  // /// A C-style cast.
724  // CCK_CStyleCast,
725  // /// A functional-style cast.
726  // CCK_FunctionalCast,
727  // /// A cast other than a C-style cast.
728  // CCK_OtherCast,
729  // /// A conversion for an operand of a builtin overloaded operator.
730  // CCK_ForBuiltinOverloadedOp
731  // };
732 
733  /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit
734  /// cast. If there is already an implicit cast, merge into the existing one.
735  /// If isLvalue, the result of the cast is an lvalue.
738  const CXXCastPath *BasePath = nullptr,
740 
741  /// ScalarTypeToBooleanCastKind - Returns the cast kind corresponding
742  /// to the conversion from scalar type ScalarTy to the Boolean type.
744 
745  /// If \p AllowLambda is true, treat lambda as function.
746  DeclContext *getFunctionLevelDeclContext(bool AllowLambda = false) const;
747 
748  /// Returns a pointer to the innermost enclosing function, or nullptr if the
749  /// current context is not inside a function. If \p AllowLambda is true,
750  /// this can return the call operator of an enclosing lambda, otherwise
751  /// lambdas are skipped when looking for an enclosing function.
752  FunctionDecl *getCurFunctionDecl(bool AllowLambda = false) const;
753 
754  /// getCurMethodDecl - If inside of a method body, this returns a pointer to
755  /// the method decl for the method being parsed. If we're currently
756  /// in a 'block', this returns the containing context.
758 
759  /// getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method
760  /// or C function we're in, otherwise return null. If we're currently
761  /// in a 'block', this returns the containing context.
763 
764  /// Warn if we're implicitly casting from a _Nullable pointer type to a
765  /// _Nonnull one.
767  SourceLocation Loc);
768 
769  /// Warn when implicitly casting 0 to nullptr.
771 
773  UnavailableAttr::ImplicitReason reason);
774 
775  /// Retrieve a suitable printing policy for diagnostics.
777  return getPrintingPolicy(Context, PP);
778  }
779 
780  /// Retrieve a suitable printing policy for diagnostics.
781  static PrintingPolicy getPrintingPolicy(const ASTContext &Ctx,
782  const Preprocessor &PP);
783 
784  /// Scope actions.
786 
787  /// Determine whether \param D is function like (function or function
788  /// template) for parsing.
790 
791  /// The maximum alignment, same as in llvm::Value. We duplicate them here
792  /// because that allows us not to duplicate the constants in clang code,
793  /// which we must to since we can't directly use the llvm constants.
794  /// The value is verified against llvm here: lib/CodeGen/CGDecl.cpp
795  ///
796  /// This is the greatest alignment value supported by load, store, and alloca
797  /// instructions, and global values.
798  static const unsigned MaxAlignmentExponent = 32;
800 
801  /// Flag indicating whether or not to collect detailed statistics.
803 
804  std::unique_ptr<sema::FunctionScopeInfo> CachedFunctionScope;
805 
806  /// Stack containing information about each of the nested
807  /// function, block, and method scopes that are currently active.
809 
810  /// The index of the first FunctionScope that corresponds to the current
811  /// context.
812  unsigned FunctionScopesStart = 0;
813 
814  /// Track the number of currently active capturing scopes.
816 
817  llvm::BumpPtrAllocator BumpAlloc;
818 
819  /// The kind of translation unit we are processing.
820  ///
821  /// When we're processing a complete translation unit, Sema will perform
822  /// end-of-translation-unit semantic tasks (such as creating
823  /// initializers for tentative definitions in C) once parsing has
824  /// completed. Modules and precompiled headers perform different kinds of
825  /// checks.
827 
828  /// Translation Unit Scope - useful to Objective-C actions that need
829  /// to lookup file scope declarations in the "ordinary" C decl namespace.
830  /// For example, user-defined classes, built-in "id" type, etc.
832 
833  bool WarnedStackExhausted = false;
834 
836  return CurScope->incrementMSManglingNumber();
837  }
838 
839  /// Try to recover by turning the given expression into a
840  /// call. Returns true if recovery was attempted or an error was
841  /// emitted; this may also leave the ExprResult invalid.
843  bool ForceComplain = false,
844  bool (*IsPlausibleResult)(QualType) = nullptr);
845 
846  /// Figure out if an expression could be turned into a call.
847  bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
848  UnresolvedSetImpl &NonTemplateOverloads);
849 
853 
856 
864 
865  /// A RAII object to enter scope of a compound statement.
867  public:
868  CompoundScopeRAII(Sema &S, bool IsStmtExpr = false) : S(S) {
869  S.ActOnStartOfCompoundStmt(IsStmtExpr);
870  }
871 
873 
874  private:
875  Sema &S;
876  };
877 
878  /// An RAII helper that pops function a function scope on exit.
880  Sema &S;
881  bool Active;
884  if (Active)
886  }
887  void disable() { Active = false; }
888  };
889 
890  /// Build a partial diagnostic.
891  PartialDiagnostic PDiag(unsigned DiagID = 0); // in SemaInternal.h
892 
894  return FunctionScopes.empty() ? nullptr : FunctionScopes.back();
895  }
896 
897  /// Worker object for performing CFG-based warnings.
900 
901  /// Callback to the parser to parse templated functions when needed.
902  typedef void LateTemplateParserCB(void *P, LateParsedTemplate &LPT);
903  typedef void LateTemplateParserCleanupCB(void *P);
907 
909  LateTemplateParserCleanupCB *LTPCleanup, void *P) {
910  LateTemplateParser = LTP;
911  LateTemplateParserCleanup = LTPCleanup;
912  OpaqueParser = P;
913  }
914 
915  /// Callback to the parser to parse a type expressed as a string.
916  std::function<TypeResult(StringRef, StringRef, SourceLocation)>
918 
919  /// VAListTagName - The declaration name corresponding to __va_list_tag.
920  /// This is used as part of a hack to omit that class from ADL results.
922 
923  /// Is the last error level diagnostic immediate. This is used to determined
924  /// whether the next info diagnostic should be immediate.
925  bool IsLastErrorImmediate = true;
926 
927  class DelayedDiagnostics;
928 
930  sema::DelayedDiagnosticPool *SavedPool = nullptr;
932  };
935 
936  /// A class which encapsulates the logic for delaying diagnostics
937  /// during parsing and other processing.
939  /// The current pool of diagnostics into which delayed
940  /// diagnostics should go.
941  sema::DelayedDiagnosticPool *CurPool = nullptr;
942 
943  public:
944  DelayedDiagnostics() = default;
945 
946  /// Adds a delayed diagnostic.
947  void add(const sema::DelayedDiagnostic &diag); // in DelayedDiagnostic.h
948 
949  /// Determines whether diagnostics should be delayed.
950  bool shouldDelayDiagnostics() { return CurPool != nullptr; }
951 
952  /// Returns the current delayed-diagnostics pool.
953  sema::DelayedDiagnosticPool *getCurrentPool() const { return CurPool; }
954 
955  /// Enter a new scope. Access and deprecation diagnostics will be
956  /// collected in this pool.
959  state.SavedPool = CurPool;
960  CurPool = &pool;
961  return state;
962  }
963 
964  /// Leave a delayed-diagnostic state that was previously pushed.
965  /// Do not emit any of the diagnostics. This is performed as part
966  /// of the bookkeeping of popping a pool "properly".
968  CurPool = state.SavedPool;
969  }
970 
971  /// Enter a new scope where access and deprecation diagnostics are
972  /// not delayed.
975  state.SavedPool = CurPool;
976  CurPool = nullptr;
977  return state;
978  }
979 
980  /// Undo a previous pushUndelayed().
982  assert(CurPool == nullptr);
983  CurPool = state.SavedPool;
984  }
986 
988  return DelayedDiagnostics.push(pool);
989  }
990 
991  /// Diagnostics that are emitted only if we discover that the given function
992  /// must be codegen'ed. Because handling these correctly adds overhead to
993  /// compilation, this is currently only enabled for CUDA compilations.
995 
996  /// CurContext - This is the current declaration context of parsing.
998 
1000  assert(CUDAPtr);
1001  return *CUDAPtr;
1002  }
1003 
1005  assert(HLSLPtr);
1006  return *HLSLPtr;
1007  }
1008 
1010  assert(OpenACCPtr);
1011  return *OpenACCPtr;
1012  }
1013 
1015  assert(OpenMPPtr && "SemaOpenMP is dead");
1016  return *OpenMPPtr;
1017  }
1018 
1020  assert(SYCLPtr);
1021  return *SYCLPtr;
1022  }
1023 
1024 protected:
1025  friend class Parser;
1027  friend class ASTReader;
1028  friend class ASTDeclReader;
1029  friend class ASTWriter;
1030 
1031 private:
1032  std::optional<std::unique_ptr<DarwinSDKInfo>> CachedDarwinSDKInfo;
1033  bool WarnedDarwinSDKInfoMissing = false;
1034 
1035  Sema(const Sema &) = delete;
1036  void operator=(const Sema &) = delete;
1037 
1038  /// Source of additional semantic information.
1040 
1041  /// The handler for the FileChanged preprocessor events.
1042  ///
1043  /// Used for diagnostics that implement custom semantic analysis for #include
1044  /// directives, like -Wpragma-pack.
1045  sema::SemaPPCallbacks *SemaPPCallbackHandler;
1046 
1047  /// The parser's current scope.
1048  ///
1049  /// The parser maintains this state here.
1050  Scope *CurScope;
1051 
1052  mutable IdentifierInfo *Ident_super;
1053 
1054  std::unique_ptr<SemaCUDA> CUDAPtr;
1055  std::unique_ptr<SemaHLSL> HLSLPtr;
1056  std::unique_ptr<SemaOpenACC> OpenACCPtr;
1057  std::unique_ptr<SemaOpenMP> OpenMPPtr;
1058  std::unique_ptr<SemaSYCL> SYCLPtr;
1059 
1060  ///@}
1061 
1062  //
1063  //
1064  // -------------------------------------------------------------------------
1065  //
1066  //
1067 
1068  /// \name C++ Access Control
1069  /// Implementations are in SemaAccess.cpp
1070  ///@{
1071 
1072 public:
1077  AR_delayed
1078  };
1079 
1080  bool SetMemberAccessSpecifier(NamedDecl *MemberDecl,
1081  NamedDecl *PrevMemberDecl,
1082  AccessSpecifier LexicalAS);
1083 
1085  DeclAccessPair FoundDecl);
1087  DeclAccessPair FoundDecl);
1089  SourceRange PlacementRange,
1090  CXXRecordDecl *NamingClass,
1091  DeclAccessPair FoundDecl,
1092  bool Diagnose = true);
1094  DeclAccessPair FoundDecl,
1095  const InitializedEntity &Entity,
1096  bool IsCopyBindingRefToTemp = false);
1098  DeclAccessPair FoundDecl,
1099  const InitializedEntity &Entity,
1100  const PartialDiagnostic &PDiag);
1102  CXXDestructorDecl *Dtor,
1103  const PartialDiagnostic &PDiag,
1104  QualType objectType = QualType());
1107  CXXRecordDecl *NamingClass,
1108  DeclAccessPair Found);
1109  AccessResult
1111  CXXRecordDecl *DecomposedClass,
1112  DeclAccessPair Field);
1114  const SourceRange &,
1115  DeclAccessPair FoundDecl);
1117  Expr *ArgExpr,
1118  DeclAccessPair FoundDecl);
1120  ArrayRef<Expr *> ArgExprs,
1121  DeclAccessPair FoundDecl);
1123  DeclAccessPair FoundDecl);
1125  QualType Derived, const CXXBasePath &Path,
1126  unsigned DiagID, bool ForceCheck = false,
1127  bool ForceUnprivileged = false);
1128  void CheckLookupAccess(const LookupResult &R);
1129  bool IsSimplyAccessible(NamedDecl *Decl, CXXRecordDecl *NamingClass,
1130  QualType BaseType);
1131  bool isMemberAccessibleForDeletion(CXXRecordDecl *NamingClass,
1132  DeclAccessPair Found, QualType ObjectType,
1133  SourceLocation Loc,
1134  const PartialDiagnostic &Diag);
1136  DeclAccessPair Found,
1137  QualType ObjectType) {
1138  return isMemberAccessibleForDeletion(NamingClass, Found, ObjectType,
1139  SourceLocation(), PDiag());
1140  }
1141 
1143  const DependentDiagnostic &DD,
1144  const MultiLevelTemplateArgumentList &TemplateArgs);
1146 
1147  ///@}
1148 
1149  //
1150  //
1151  // -------------------------------------------------------------------------
1152  //
1153  //
1154 
1155  /// \name Attributes
1156  /// Implementations are in SemaAttr.cpp
1157  ///@{
1158 
1159 public:
1160  /// Controls member pointer representation format under the MS ABI.
1163 
1164  bool MSStructPragmaOn; // True when \#pragma ms_struct on
1165 
1166  /// Source location for newly created implicit MSInheritanceAttrs
1168 
1169  /// pragma clang section kind
1176  PCSK_Relro = 5
1177  };
1178 
1180 
1182  std::string SectionName;
1183  bool Valid = false;
1185  };
1186 
1192 
1194  PSK_Reset = 0x0, // #pragma ()
1195  PSK_Set = 0x1, // #pragma (value)
1196  PSK_Push = 0x2, // #pragma (push[, id])
1197  PSK_Pop = 0x4, // #pragma (pop[, id])
1198  PSK_Show = 0x8, // #pragma (show) -- only for "pack"!
1199  PSK_Push_Set = PSK_Push | PSK_Set, // #pragma (push[, id], value)
1200  PSK_Pop_Set = PSK_Pop | PSK_Set, // #pragma (pop[, id], value)
1201  };
1202 
1205  StringRef SlotLabel;
1207  };
1208 
1209  // #pragma pack and align.
1211  public:
1212  // `Native` represents default align mode, which may vary based on the
1213  // platform.
1214  enum Mode : unsigned char { Native, Natural, Packed, Mac68k };
1215 
1216  // #pragma pack info constructor
1217  AlignPackInfo(AlignPackInfo::Mode M, unsigned Num, bool IsXL)
1218  : PackAttr(true), AlignMode(M), PackNumber(Num), XLStack(IsXL) {
1219  assert(Num == PackNumber && "The pack number has been truncated.");
1220  }
1221 
1222  // #pragma align info constructor
1224  : PackAttr(false), AlignMode(M),
1225  PackNumber(M == Packed ? 1 : UninitPackVal), XLStack(IsXL) {}
1226 
1227  explicit AlignPackInfo(bool IsXL) : AlignPackInfo(Native, IsXL) {}
1228 
1230 
1231  // When a AlignPackInfo itself cannot be used, this returns an 32-bit
1232  // integer encoding for it. This should only be passed to
1233  // AlignPackInfo::getFromRawEncoding, it should not be inspected directly.
1234  static uint32_t getRawEncoding(const AlignPackInfo &Info) {
1235  std::uint32_t Encoding{};
1236  if (Info.IsXLStack())
1237  Encoding |= IsXLMask;
1238 
1239  Encoding |= static_cast<uint32_t>(Info.getAlignMode()) << 1;
1240 
1241  if (Info.IsPackAttr())
1242  Encoding |= PackAttrMask;
1243 
1244  Encoding |= static_cast<uint32_t>(Info.getPackNumber()) << 4;
1245 
1246  return Encoding;
1247  }
1248 
1250  bool IsXL = static_cast<bool>(Encoding & IsXLMask);
1252  static_cast<AlignPackInfo::Mode>((Encoding & AlignModeMask) >> 1);
1253  int PackNumber = (Encoding & PackNumMask) >> 4;
1254 
1255  if (Encoding & PackAttrMask)
1256  return AlignPackInfo(M, PackNumber, IsXL);
1257 
1258  return AlignPackInfo(M, IsXL);
1259  }
1260 
1261  bool IsPackAttr() const { return PackAttr; }
1262 
1263  bool IsAlignAttr() const { return !PackAttr; }
1264 
1265  Mode getAlignMode() const { return AlignMode; }
1266 
1267  unsigned getPackNumber() const { return PackNumber; }
1268 
1269  bool IsPackSet() const {
1270  // #pragma align, #pragma pack(), and #pragma pack(0) do not set the pack
1271  // attriute on a decl.
1272  return PackNumber != UninitPackVal && PackNumber != 0;
1273  }
1274 
1275  bool IsXLStack() const { return XLStack; }
1276 
1277  bool operator==(const AlignPackInfo &Info) const {
1278  return std::tie(AlignMode, PackNumber, PackAttr, XLStack) ==
1279  std::tie(Info.AlignMode, Info.PackNumber, Info.PackAttr,
1280  Info.XLStack);
1281  }
1282 
1283  bool operator!=(const AlignPackInfo &Info) const {
1284  return !(*this == Info);
1285  }
1286 
1287  private:
1288  /// \brief True if this is a pragma pack attribute,
1289  /// not a pragma align attribute.
1290  bool PackAttr;
1291 
1292  /// \brief The alignment mode that is in effect.
1293  Mode AlignMode;
1294 
1295  /// \brief The pack number of the stack.
1296  unsigned char PackNumber;
1297 
1298  /// \brief True if it is a XL #pragma align/pack stack.
1299  bool XLStack;
1300 
1301  /// \brief Uninitialized pack value.
1302  static constexpr unsigned char UninitPackVal = -1;
1303 
1304  // Masks to encode and decode an AlignPackInfo.
1305  static constexpr uint32_t IsXLMask{0x0000'0001};
1306  static constexpr uint32_t AlignModeMask{0x0000'0006};
1307  static constexpr uint32_t PackAttrMask{0x00000'0008};
1308  static constexpr uint32_t PackNumMask{0x0000'01F0};
1309  };
1310 
1311  template <typename ValueType> struct PragmaStack {
1312  struct Slot {
1313  llvm::StringRef StackSlotLabel;
1314  ValueType Value;
1317  Slot(llvm::StringRef StackSlotLabel, ValueType Value,
1322  };
1323 
1324  void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action,
1325  llvm::StringRef StackSlotLabel, ValueType Value) {
1326  if (Action == PSK_Reset) {
1328  CurrentPragmaLocation = PragmaLocation;
1329  return;
1330  }
1331  if (Action & PSK_Push)
1332  Stack.emplace_back(StackSlotLabel, CurrentValue, CurrentPragmaLocation,
1333  PragmaLocation);
1334  else if (Action & PSK_Pop) {
1335  if (!StackSlotLabel.empty()) {
1336  // If we've got a label, try to find it and jump there.
1337  auto I = llvm::find_if(llvm::reverse(Stack), [&](const Slot &x) {
1338  return x.StackSlotLabel == StackSlotLabel;
1339  });
1340  // If we found the label so pop from there.
1341  if (I != Stack.rend()) {
1342  CurrentValue = I->Value;
1343  CurrentPragmaLocation = I->PragmaLocation;
1344  Stack.erase(std::prev(I.base()), Stack.end());
1345  }
1346  } else if (!Stack.empty()) {
1347  // We do not have a label, just pop the last entry.
1348  CurrentValue = Stack.back().Value;
1349  CurrentPragmaLocation = Stack.back().PragmaLocation;
1350  Stack.pop_back();
1351  }
1352  }
1353  if (Action & PSK_Set) {
1354  CurrentValue = Value;
1355  CurrentPragmaLocation = PragmaLocation;
1356  }
1357  }
1358 
1359  // MSVC seems to add artificial slots to #pragma stacks on entering a C++
1360  // method body to restore the stacks on exit, so it works like this:
1361  //
1362  // struct S {
1363  // #pragma <name>(push, InternalPragmaSlot, <current_pragma_value>)
1364  // void Method {}
1365  // #pragma <name>(pop, InternalPragmaSlot)
1366  // };
1367  //
1368  // It works even with #pragma vtordisp, although MSVC doesn't support
1369  // #pragma vtordisp(push [, id], n)
1370  // syntax.
1371  //
1372  // Push / pop a named sentinel slot.
1373  void SentinelAction(PragmaMsStackAction Action, StringRef Label) {
1374  assert((Action == PSK_Push || Action == PSK_Pop) &&
1375  "Can only push / pop #pragma stack sentinels!");
1377  }
1378 
1379  // Constructors.
1380  explicit PragmaStack(const ValueType &Default)
1382 
1383  bool hasValue() const { return CurrentValue != DefaultValue; }
1384 
1386  ValueType DefaultValue; // Value used for PSK_Reset action.
1387  ValueType CurrentValue;
1389  };
1390  // FIXME: We should serialize / deserialize these if they occur in a PCH (but
1391  // we shouldn't do so if they're in a module).
1392 
1393  /// Whether to insert vtordisps prior to virtual bases in the Microsoft
1394  /// C++ ABI. Possible values are 0, 1, and 2, which mean:
1395  ///
1396  /// 0: Suppress all vtordisps
1397  /// 1: Insert vtordisps in the presence of vbase overrides and non-trivial
1398  /// structors
1399  /// 2: Always insert vtordisps to support RTTI on partially constructed
1400  /// objects
1403  // The current #pragma align/pack values and locations at each #include.
1408  };
1410  // Segment #pragmas.
1415 
1416  // #pragma strict_gs_check.
1418 
1419  // This stack tracks the current state of Sema.CurFPFeatures.
1422  FPOptionsOverride result;
1423  if (!FpPragmaStack.hasValue()) {
1424  result = FPOptionsOverride();
1425  } else {
1426  result = FpPragmaStack.CurrentValue;
1427  }
1428  return result;
1429  }
1430 
1436  };
1437 
1438  // RAII object to push / pop sentinel slots for all MS #pragma stacks.
1439  // Actions should be performed only if we enter / exit a C++ method body.
1441  public:
1442  PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct);
1444 
1445  private:
1446  Sema &S;
1447  StringRef SlotLabel;
1448  bool ShouldAct;
1449  };
1450 
1451  /// Last section used with #pragma init_seg.
1454 
1455  /// Sections used with #pragma alloc_text.
1456  llvm::StringMap<std::tuple<StringRef, SourceLocation>> FunctionToSectionMap;
1457 
1458  /// VisContext - Manages the stack for \#pragma GCC visibility.
1459  void *VisContext; // Really a "PragmaVisStack*"
1460 
1461  /// This an attribute introduced by \#pragma clang attribute.
1466  bool IsUsed;
1467  };
1468 
1469  /// A push'd group of PragmaAttributeEntries.
1471  /// The location of the push attribute.
1473  /// The namespace of this push group.
1476  };
1477 
1479 
1480  /// The declaration that is currently receiving an attribute from the
1481  /// #pragma attribute stack.
1483 
1484  /// This represents the last location of a "#pragma clang optimize off"
1485  /// directive if such a directive has not been closed by an "on" yet. If
1486  /// optimizations are currently "on", this is set to an invalid location.
1488 
1489  /// Get the location for the currently active "\#pragma clang optimize
1490  /// off". If this location is invalid, then the state of the pragma is "on".
1493  }
1494 
1495  /// The "on" or "off" argument passed by \#pragma optimize, that denotes
1496  /// whether the optimizations in the list passed to the pragma should be
1497  /// turned off or on. This boolean is true by default because command line
1498  /// options are honored when `#pragma optimize("", on)`.
1499  /// (i.e. `ModifyFnAttributeMSPragmaOptimze()` does nothing)
1501 
1502  /// Set of no-builtin functions listed by \#pragma function.
1504 
1505  /// AddAlignmentAttributesForRecord - Adds any needed alignment attributes to
1506  /// a the record decl, to handle '\#pragma pack' and '\#pragma options align'.
1508 
1509  /// AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
1511 
1512  /// Add gsl::Pointer attribute to std::container::iterator
1513  /// \param ND The declaration that introduces the name
1514  /// std::container::iterator. \param UnderlyingRecord The record named by ND.
1515  void inferGslPointerAttribute(NamedDecl *ND, CXXRecordDecl *UnderlyingRecord);
1516 
1517  /// Add [[gsl::Owner]] and [[gsl::Pointer]] attributes for std:: types.
1519 
1520  /// Add [[gsl::Pointer]] attributes for std:: types.
1522 
1523  /// Add _Nullable attributes for std:: types.
1525 
1527  POAK_Native, // #pragma options align=native
1528  POAK_Natural, // #pragma options align=natural
1529  POAK_Packed, // #pragma options align=packed
1530  POAK_Power, // #pragma options align=power
1531  POAK_Mac68k, // #pragma options align=mac68k
1532  POAK_Reset // #pragma options align=reset
1533  };
1534 
1535  /// ActOnPragmaClangSection - Called on well formed \#pragma clang section
1536  void ActOnPragmaClangSection(SourceLocation PragmaLoc,
1537  PragmaClangSectionAction Action,
1538  PragmaClangSectionKind SecKind,
1539  StringRef SecName);
1540 
1541  /// ActOnPragmaOptionsAlign - Called on well formed \#pragma options align.
1543  SourceLocation PragmaLoc);
1544 
1545  /// ActOnPragmaPack - Called on well formed \#pragma pack(...).
1546  void ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action,
1547  StringRef SlotLabel, Expr *Alignment);
1548 
1549  /// ConstantFoldAttrArgs - Folds attribute arguments into ConstantExprs
1550  /// (unless they are value dependent or type dependent). Returns false
1551  /// and emits a diagnostic if one or more of the arguments could not be
1552  /// folded into a constant.
1555 
1559  };
1560 
1562  SourceLocation IncludeLoc);
1564 
1565  /// ActOnPragmaMSStruct - Called on well formed \#pragma ms_struct [on|off].
1567 
1568  /// ActOnPragmaMSComment - Called on well formed
1569  /// \#pragma comment(kind, "arg").
1571  StringRef Arg);
1572 
1573  /// ActOnPragmaDetectMismatch - Call on well-formed \#pragma detect_mismatch
1574  void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name,
1575  StringRef Value);
1576 
1577  /// Are precise floating point semantics currently enabled?
1579  return !CurFPFeatures.getAllowFPReassociate() &&
1580  !CurFPFeatures.getNoSignedZero() &&
1581  !CurFPFeatures.getAllowReciprocal() &&
1582  !CurFPFeatures.getAllowApproxFunc();
1583  }
1584 
1587 
1588  /// ActOnPragmaFloatControl - Call on well-formed \#pragma float_control
1591 
1592  /// ActOnPragmaMSPointersToMembers - called on well formed \#pragma
1593  /// pointers_to_members(representation method[, general purpose
1594  /// representation]).
1597  SourceLocation PragmaLoc);
1598 
1599  /// Called on well formed \#pragma vtordisp().
1601  SourceLocation PragmaLoc, MSVtorDispMode Value);
1602 
1603  bool UnifySection(StringRef SectionName, int SectionFlags,
1604  NamedDecl *TheDecl);
1605  bool UnifySection(StringRef SectionName, int SectionFlags,
1606  SourceLocation PragmaSectionLocation);
1607 
1608  /// Called on well formed \#pragma bss_seg/data_seg/const_seg/code_seg.
1609  void ActOnPragmaMSSeg(SourceLocation PragmaLocation,
1610  PragmaMsStackAction Action,
1611  llvm::StringRef StackSlotLabel,
1612  StringLiteral *SegmentName, llvm::StringRef PragmaName);
1613 
1614  /// Called on well formed \#pragma section().
1615  void ActOnPragmaMSSection(SourceLocation PragmaLocation, int SectionFlags,
1616  StringLiteral *SegmentName);
1617 
1618  /// Called on well-formed \#pragma init_seg().
1619  void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation,
1620  StringLiteral *SegmentName);
1621 
1622  /// Called on well-formed \#pragma alloc_text().
1624  SourceLocation PragmaLocation, StringRef Section,
1625  const SmallVector<std::tuple<IdentifierInfo *, SourceLocation>>
1626  &Functions);
1627 
1628  /// ActOnPragmaMSStrictGuardStackCheck - Called on well formed \#pragma
1629  /// strict_gs_check.
1631  PragmaMsStackAction Action,
1632  bool Value);
1633 
1634  /// ActOnPragmaUnused - Called on well-formed '\#pragma unused'.
1635  void ActOnPragmaUnused(const Token &Identifier, Scope *curScope,
1636  SourceLocation PragmaLoc);
1637 
1638  /// AddCFAuditedAttribute - Check whether we're currently within
1639  /// '\#pragma clang arc_cf_code_audited' and, if so, consider adding
1640  /// the appropriate attribute.
1641  void AddCFAuditedAttribute(Decl *D);
1642 
1643  void ActOnPragmaAttributeAttribute(ParsedAttr &Attribute,
1644  SourceLocation PragmaLoc,
1647  const IdentifierInfo *Namespace);
1648 
1649  /// Called on well-formed '\#pragma clang attribute pop'.
1650  void ActOnPragmaAttributePop(SourceLocation PragmaLoc,
1651  const IdentifierInfo *Namespace);
1652 
1653  /// Adds the attributes that have been specified using the
1654  /// '\#pragma clang attribute push' directives to the given declaration.
1655  void AddPragmaAttributes(Scope *S, Decl *D);
1656 
1658 
1660 
1661  /// Called on well formed \#pragma clang optimize.
1662  void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc);
1663 
1664  /// #pragma optimize("[optimization-list]", on | off).
1665  void ActOnPragmaMSOptimize(SourceLocation Loc, bool IsOn);
1666 
1667  /// Call on well formed \#pragma function.
1668  void
1670  const llvm::SmallVectorImpl<StringRef> &NoBuiltins);
1671 
1672  /// Only called on function definitions; if there is a pragma in scope
1673  /// with the effect of a range-based optnone, consider marking the function
1674  /// with attribute optnone.
1676 
1677  /// Only called on function definitions; if there is a `#pragma alloc_text`
1678  /// that decides which code section the function should be in, add
1679  /// attribute section to the function.
1681 
1682  /// Adds the 'optnone' attribute to the function declaration if there
1683  /// are no conflicts; Loc represents the location causing the 'optnone'
1684  /// attribute to be added (usually because of a pragma).
1686 
1687  /// Only called on function definitions; if there is a MSVC #pragma optimize
1688  /// in scope, consider changing the function's attributes based on the
1689  /// optimization list passed to the pragma.
1691 
1692  /// Only called on function definitions; if there is a pragma in scope
1693  /// with the effect of a range-based no_builtin, consider marking the function
1694  /// with attribute no_builtin.
1696 
1697  /// AddPushedVisibilityAttribute - If '\#pragma GCC visibility' was used,
1698  /// add an appropriate visibility attribute.
1700 
1701  /// FreeVisContext - Deallocate and null out VisContext.
1702  void FreeVisContext();
1703 
1704  /// ActOnPragmaVisibility - Called on well formed \#pragma GCC visibility... .
1705  void ActOnPragmaVisibility(const IdentifierInfo *VisType,
1706  SourceLocation PragmaLoc);
1707 
1708  /// ActOnPragmaFPContract - Called on well formed
1709  /// \#pragma {STDC,OPENCL} FP_CONTRACT and
1710  /// \#pragma clang fp contract
1712 
1713  /// Called on well formed
1714  /// \#pragma clang fp reassociate
1715  /// or
1716  /// \#pragma clang fp reciprocal
1718  bool IsEnabled);
1719 
1720  /// ActOnPragmaFenvAccess - Called on well formed
1721  /// \#pragma STDC FENV_ACCESS
1722  void ActOnPragmaFEnvAccess(SourceLocation Loc, bool IsEnabled);
1723 
1724  /// ActOnPragmaCXLimitedRange - Called on well formed
1725  /// \#pragma STDC CX_LIMITED_RANGE
1728 
1729  /// Called on well formed '\#pragma clang fp' that has option 'exceptions'.
1732 
1733  /// Called to set constant rounding mode for floating point operations.
1734  void ActOnPragmaFEnvRound(SourceLocation Loc, llvm::RoundingMode);
1735 
1736  /// Called to set exception behavior for floating point operations.
1738 
1739  /// PushNamespaceVisibilityAttr - Note that we've entered a
1740  /// namespace with a visibility attribute.
1741  void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr,
1742  SourceLocation Loc);
1743 
1744  /// PopPragmaVisibility - Pop the top element of the visibility stack; used
1745  /// for '\#pragma GCC visibility' and visibility attributes on namespaces.
1746  void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc);
1747 
1748  /// Handles semantic checking for features that are common to all attributes,
1749  /// such as checking whether a parameter was properly specified, or the
1750  /// correct number of arguments were passed, etc. Returns true if the
1751  /// attribute has been diagnosed.
1752  bool checkCommonAttributeFeatures(const Decl *D, const ParsedAttr &A,
1753  bool SkipArgCountCheck = false);
1754  bool checkCommonAttributeFeatures(const Stmt *S, const ParsedAttr &A,
1755  bool SkipArgCountCheck = false);
1756 
1757  ///@}
1758 
1759  //
1760  //
1761  // -------------------------------------------------------------------------
1762  //
1763  //
1764 
1765  /// \name Availability Attribute Handling
1766  /// Implementations are in SemaAvailability.cpp
1767  ///@{
1768 
1769 public:
1770  /// Issue any -Wunguarded-availability warnings in \c FD
1772 
1774 
1775  /// Retrieve the current function, if any, that should be analyzed for
1776  /// potential availability violations.
1778 
1780  const ObjCInterfaceDecl *UnknownObjCClass,
1781  bool ObjCPropertyAccess,
1782  bool AvoidPartialAvailabilityChecks = false,
1783  ObjCInterfaceDecl *ClassReceiver = nullptr);
1784 
1785  ///@}
1786 
1787  //
1788  //
1789  // -------------------------------------------------------------------------
1790  //
1791  //
1792 
1793  /// \name Casts
1794  /// Implementations are in SemaCast.cpp
1795  ///@{
1796 
1797 public:
1798  static bool isCast(CheckedConversionKind CCK) {
1799  return CCK == CheckedConversionKind::CStyleCast ||
1802  }
1803 
1804  /// ActOnCXXNamedCast - Parse
1805  /// {dynamic,static,reinterpret,const,addrspace}_cast's.
1807  SourceLocation LAngleBracketLoc, Declarator &D,
1808  SourceLocation RAngleBracketLoc,
1809  SourceLocation LParenLoc, Expr *E,
1810  SourceLocation RParenLoc);
1811 
1813  TypeSourceInfo *Ty, Expr *E,
1814  SourceRange AngleBrackets, SourceRange Parens);
1815 
1817  ExprResult Operand,
1818  SourceLocation RParenLoc);
1819 
1821  Expr *Operand, SourceLocation RParenLoc);
1822 
1823  // Checks that reinterpret casts don't have undefined behavior.
1824  void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType,
1825  bool IsDereference, SourceRange Range);
1826 
1827  // Checks that the vector type should be initialized from a scalar
1828  // by splatting the value rather than populating a single element.
1829  // This is the case for AltiVecVector types as well as with
1830  // AltiVecPixel and AltiVecBool when -faltivec-src-compat=xl is specified.
1831  bool ShouldSplatAltivecScalarInCast(const VectorType *VecTy);
1832 
1833  // Checks if the -faltivec-src-compat=gcc option is specified.
1834  // If so, AltiVecVector, AltiVecBool and AltiVecPixel types are
1835  // treated the same way as they are when trying to initialize
1836  // these vectors on gcc (an error is emitted).
1838  QualType SrcTy);
1839 
1841  SourceLocation RParenLoc, Expr *Op);
1842 
1844  SourceLocation LParenLoc,
1845  Expr *CastExpr,
1846  SourceLocation RParenLoc);
1847 
1848  ///@}
1849 
1850  //
1851  //
1852  // -------------------------------------------------------------------------
1853  //
1854  //
1855 
1856  /// \name Extra Semantic Checking
1857  /// Implementations are in SemaChecking.cpp
1858  ///@{
1859 
1860 public:
1861  /// Used to change context to isConstantEvaluated without pushing a heavy
1862  /// ExpressionEvaluationContextRecord object.
1864 
1868  }
1869 
1871  unsigned ByteNo) const;
1872 
1874  FAPK_Fixed, // values to format are fixed (no C-style variadic arguments)
1875  FAPK_Variadic, // values to format are passed as variadic arguments
1876  FAPK_VAList, // values to format are passed in a va_list
1877  };
1878 
1879  // Used to grab the relevant information from a FormatAttr and a
1880  // FunctionDeclaration.
1882  unsigned FormatIdx;
1883  unsigned FirstDataArg;
1885  };
1886 
1887  static bool getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember,
1888  bool IsVariadic, FormatStringInfo *FSI);
1889 
1890  // Used by C++ template instantiation.
1893  SourceLocation BuiltinLoc,
1894  SourceLocation RParenLoc);
1895 
1906  FST_Unknown
1907  };
1908  static FormatStringType GetFormatStringType(const FormatAttr *Format);
1909 
1910  bool FormatStringHasSArg(const StringLiteral *FExpr);
1911 
1912  static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx);
1913 
1914  void CheckFloatComparison(SourceLocation Loc, Expr *LHS, Expr *RHS,
1916 
1917  /// Register a magic integral constant to be used as a type tag.
1918  void RegisterTypeTagForDatatype(const IdentifierInfo *ArgumentKind,
1919  uint64_t MagicValue, QualType Type,
1920  bool LayoutCompatible, bool MustBeNull);
1921 
1922  struct TypeTagData {
1924 
1928 
1930 
1931  /// If true, \c Type should be compared with other expression's types for
1932  /// layout-compatibility.
1933  LLVM_PREFERRED_TYPE(bool)
1935  LLVM_PREFERRED_TYPE(bool)
1936  unsigned MustBeNull : 1;
1937  };
1938 
1939  /// A pair of ArgumentKind identifier and magic value. This uniquely
1940  /// identifies the magic value.
1942 
1943  /// Diagnoses the current set of gathered accesses. This typically
1944  /// happens at full expression level. The set is cleared after emitting the
1945  /// diagnostics.
1947 
1948  /// This function checks if the expression is in the sef of potentially
1949  /// misaligned members and it is converted to some pointer type T with lower
1950  /// or equal alignment requirements. If so it removes it. This is used when
1951  /// we do not want to diagnose such misaligned access (e.g. in conversions to
1952  /// void*).
1953  void DiscardMisalignedMemberAddress(const Type *T, Expr *E);
1954 
1955  /// This function calls Action when it determines that E designates a
1956  /// misaligned member due to the packed attribute. This is used to emit
1957  /// local diagnostics like in reference binding.
1959  Expr *E,
1960  llvm::function_ref<void(Expr *, RecordDecl *, FieldDecl *, CharUnits)>
1961  Action);
1962 
1963  enum class AtomicArgumentOrder { API, AST };
1964  ExprResult
1965  BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
1966  SourceLocation RParenLoc, MultiExprArg Args,
1969 
1970  /// Check to see if a given expression could have '.c_str()' called on it.
1971  bool hasCStrMethod(const Expr *E);
1972 
1975  bool IsEqual, SourceRange Range);
1976 
1978  bool CheckParameterNames);
1979 
1980  void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange);
1981 
1982  /// checkRetainCycles - Check whether an Objective-C message send
1983  /// might create an obvious retain cycle.
1985  void checkRetainCycles(Expr *receiver, Expr *argument);
1986  void checkRetainCycles(VarDecl *Var, Expr *Init);
1987 
1988  /// checkUnsafeAssigns - Check whether +1 expr is being assigned
1989  /// to weak/__unsafe_unretained type.
1990  bool checkUnsafeAssigns(SourceLocation Loc, QualType LHS, Expr *RHS);
1991 
1992  /// checkUnsafeExprAssigns - Check whether +1 expr is being assigned
1993  /// to weak/__unsafe_unretained expression.
1994  void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS);
1995 
1996  /// Emit \p DiagID if statement located on \p StmtLoc has a suspicious null
1997  /// statement as a \p Body, and it is located on the same line.
1998  ///
1999  /// This helps prevent bugs due to typos, such as:
2000  /// if (condition);
2001  /// do_stuff();
2002  void DiagnoseEmptyStmtBody(SourceLocation StmtLoc, const Stmt *Body,
2003  unsigned DiagID);
2004 
2005  /// Warn if a for/while loop statement \p S, which is followed by
2006  /// \p PossibleBody, has a suspicious null statement as a body.
2007  void DiagnoseEmptyLoopBody(const Stmt *S, const Stmt *PossibleBody);
2008 
2009  /// Warn if a value is moved to itself.
2010  void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr,
2011  SourceLocation OpLoc);
2012 
2013  // Used for emitting the right warning by DefaultVariadicArgumentPromotion
2020  };
2021 
2022  bool IsLayoutCompatible(QualType T1, QualType T2) const;
2024  const TypeSourceInfo *Derived);
2025 
2026  bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall,
2027  const FunctionProtoType *Proto);
2028 
2029  bool BuiltinVectorMath(CallExpr *TheCall, QualType &Res);
2030  bool BuiltinVectorToScalarMath(CallExpr *TheCall);
2031 
2032  bool CheckHLSLBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
2033 
2034 private:
2035  void CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
2036  const ArraySubscriptExpr *ASE = nullptr,
2037  bool AllowOnePastEnd = true, bool IndexNegated = false);
2038  void CheckArrayAccess(const Expr *E);
2039 
2040  bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc,
2041  ArrayRef<const Expr *> Args);
2042  bool CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall,
2043  const FunctionProtoType *Proto);
2044  bool CheckOtherCall(CallExpr *TheCall, const FunctionProtoType *Proto);
2045  void CheckConstructorCall(FunctionDecl *FDecl, QualType ThisType,
2047  const FunctionProtoType *Proto, SourceLocation Loc);
2048 
2049  void checkAIXMemberAlignment(SourceLocation Loc, const Expr *Arg);
2050 
2051  void CheckArgAlignment(SourceLocation Loc, NamedDecl *FDecl,
2052  StringRef ParamName, QualType ArgTy, QualType ParamTy);
2053 
2054  void checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
2055  const Expr *ThisArg, ArrayRef<const Expr *> Args,
2056  bool IsMemberFunction, SourceLocation Loc, SourceRange Range,
2057  VariadicCallType CallType);
2058 
2059  bool CheckObjCString(Expr *Arg);
2060  ExprResult CheckOSLogFormatStringArg(Expr *Arg);
2061 
2062  ExprResult CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
2063  CallExpr *TheCall);
2064 
2065  bool CheckTSBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2066  CallExpr *TheCall);
2067 
2068  void checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD, CallExpr *TheCall);
2069 
2070  bool CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
2071  unsigned MaxWidth);
2072  bool CheckNeonBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2073  CallExpr *TheCall);
2074  bool CheckMVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
2075  bool CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
2076  bool ParseSVEImmChecks(CallExpr *TheCall,
2077  SmallVector<std::tuple<int, int, int>, 3> &ImmChecks);
2078  bool CheckSMEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
2079  bool CheckCDEBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2080  CallExpr *TheCall);
2081  bool CheckARMCoprocessorImmediate(const TargetInfo &TI, const Expr *CoprocArg,
2082  bool WantCDE);
2083  bool CheckARMBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2084  CallExpr *TheCall);
2085 
2086  bool CheckAArch64BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2087  CallExpr *TheCall);
2088  bool CheckBPFBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
2089  bool CheckHexagonBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
2090  bool CheckHexagonBuiltinArgument(unsigned BuiltinID, CallExpr *TheCall);
2091  bool CheckMipsBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2092  CallExpr *TheCall);
2093  bool CheckMipsBuiltinCpu(const TargetInfo &TI, unsigned BuiltinID,
2094  CallExpr *TheCall);
2095  bool CheckMipsBuiltinArgument(unsigned BuiltinID, CallExpr *TheCall);
2096  bool CheckSystemZBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
2097  bool CheckX86BuiltinRoundingOrSAE(unsigned BuiltinID, CallExpr *TheCall);
2098  bool CheckX86BuiltinGatherScatterScale(unsigned BuiltinID, CallExpr *TheCall);
2099  bool CheckX86BuiltinTileArguments(unsigned BuiltinID, CallExpr *TheCall);
2100  bool CheckX86BuiltinTileArgumentsRange(CallExpr *TheCall,
2101  ArrayRef<int> ArgNums);
2102  bool CheckX86BuiltinTileDuplicate(CallExpr *TheCall, ArrayRef<int> ArgNums);
2103  bool CheckX86BuiltinTileRangeAndDuplicate(CallExpr *TheCall,
2104  ArrayRef<int> ArgNums);
2105  bool CheckX86BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2106  CallExpr *TheCall);
2107  bool CheckPPCBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2108  CallExpr *TheCall);
2109  bool CheckAMDGCNBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
2110  bool CheckRISCVLMUL(CallExpr *TheCall, unsigned ArgNum);
2111  bool CheckRISCVBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2112  CallExpr *TheCall);
2113  void checkRVVTypeSupport(QualType Ty, SourceLocation Loc, Decl *D,
2114  const llvm::StringMap<bool> &FeatureMap);
2115  bool CheckLoongArchBuiltinFunctionCall(const TargetInfo &TI,
2116  unsigned BuiltinID, CallExpr *TheCall);
2117  bool CheckWebAssemblyBuiltinFunctionCall(const TargetInfo &TI,
2118  unsigned BuiltinID,
2119  CallExpr *TheCall);
2120  bool CheckNVPTXBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
2121  CallExpr *TheCall);
2122 
2123  bool BuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall);
2124  bool BuiltinVAStartARMMicrosoft(CallExpr *Call);
2125  bool BuiltinUnorderedCompare(CallExpr *TheCall, unsigned BuiltinID);
2126  bool BuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs,
2127  unsigned BuiltinID);
2128  bool BuiltinComplex(CallExpr *TheCall);
2129  bool BuiltinVSX(CallExpr *TheCall);
2130  bool BuiltinOSLogFormat(CallExpr *TheCall);
2131  bool ValueIsRunOfOnes(CallExpr *TheCall, unsigned ArgNum);
2132 
2133  bool BuiltinPrefetch(CallExpr *TheCall);
2134  bool BuiltinAllocaWithAlign(CallExpr *TheCall);
2135  bool BuiltinArithmeticFence(CallExpr *TheCall);
2136  bool BuiltinAssume(CallExpr *TheCall);
2137  bool BuiltinAssumeAligned(CallExpr *TheCall);
2138  bool BuiltinLongjmp(CallExpr *TheCall);
2139  bool BuiltinSetjmp(CallExpr *TheCall);
2140  ExprResult BuiltinAtomicOverloaded(ExprResult TheCallResult);
2141  ExprResult BuiltinNontemporalOverloaded(ExprResult TheCallResult);
2142  ExprResult AtomicOpsOverloaded(ExprResult TheCallResult,
2144  bool BuiltinConstantArg(CallExpr *TheCall, int ArgNum, llvm::APSInt &Result);
2145  bool BuiltinConstantArgRange(CallExpr *TheCall, int ArgNum, int Low, int High,
2146  bool RangeIsError = true);
2147  bool BuiltinConstantArgMultiple(CallExpr *TheCall, int ArgNum,
2148  unsigned Multiple);
2149  bool BuiltinConstantArgPower2(CallExpr *TheCall, int ArgNum);
2150  bool BuiltinConstantArgShiftedByte(CallExpr *TheCall, int ArgNum,
2151  unsigned ArgBits);
2152  bool BuiltinConstantArgShiftedByteOrXXFF(CallExpr *TheCall, int ArgNum,
2153  unsigned ArgBits);
2154  bool BuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall, int ArgNum,
2155  unsigned ExpectedFieldNum, bool AllowName);
2156  bool BuiltinARMMemoryTaggingCall(unsigned BuiltinID, CallExpr *TheCall);
2157  bool BuiltinPPCMMACall(CallExpr *TheCall, unsigned BuiltinID,
2158  const char *TypeDesc);
2159 
2160  bool CheckPPCMMAType(QualType Type, SourceLocation TypeLoc);
2161 
2162  bool BuiltinElementwiseMath(CallExpr *TheCall);
2163  bool BuiltinElementwiseTernaryMath(CallExpr *TheCall,
2164  bool CheckForFloatArgs = true);
2165  bool PrepareBuiltinElementwiseMathOneArgCall(CallExpr *TheCall);
2166  bool PrepareBuiltinReduceMathOneArgCall(CallExpr *TheCall);
2167 
2168  bool BuiltinNonDeterministicValue(CallExpr *TheCall);
2169 
2170  // Matrix builtin handling.
2171  ExprResult BuiltinMatrixTranspose(CallExpr *TheCall, ExprResult CallResult);
2172  ExprResult BuiltinMatrixColumnMajorLoad(CallExpr *TheCall,
2173  ExprResult CallResult);
2174  ExprResult BuiltinMatrixColumnMajorStore(CallExpr *TheCall,
2175  ExprResult CallResult);
2176 
2177  // WebAssembly builtin handling.
2178  bool BuiltinWasmRefNullExtern(CallExpr *TheCall);
2179  bool BuiltinWasmRefNullFunc(CallExpr *TheCall);
2180  bool BuiltinWasmTableGet(CallExpr *TheCall);
2181  bool BuiltinWasmTableSet(CallExpr *TheCall);
2182  bool BuiltinWasmTableSize(CallExpr *TheCall);
2183  bool BuiltinWasmTableGrow(CallExpr *TheCall);
2184  bool BuiltinWasmTableFill(CallExpr *TheCall);
2185  bool BuiltinWasmTableCopy(CallExpr *TheCall);
2186 
2187  bool CheckFormatArguments(const FormatAttr *Format,
2188  ArrayRef<const Expr *> Args, bool IsCXXMember,
2189  VariadicCallType CallType, SourceLocation Loc,
2190  SourceRange Range,
2191  llvm::SmallBitVector &CheckedVarArgs);
2192  bool CheckFormatArguments(ArrayRef<const Expr *> Args,
2193  FormatArgumentPassingKind FAPK, unsigned format_idx,
2194  unsigned firstDataArg, FormatStringType Type,
2195  VariadicCallType CallType, SourceLocation Loc,
2197  llvm::SmallBitVector &CheckedVarArgs);
2198 
2199  void CheckInfNaNFunction(const CallExpr *Call, const FunctionDecl *FDecl);
2200 
2201  void CheckAbsoluteValueFunction(const CallExpr *Call,
2202  const FunctionDecl *FDecl);
2203 
2204  void CheckMaxUnsignedZero(const CallExpr *Call, const FunctionDecl *FDecl);
2205 
2206  void CheckMemaccessArguments(const CallExpr *Call, unsigned BId,
2207  IdentifierInfo *FnName);
2208 
2209  void CheckStrlcpycatArguments(const CallExpr *Call, IdentifierInfo *FnName);
2210 
2211  void CheckStrncatArguments(const CallExpr *Call, IdentifierInfo *FnName);
2212 
2213  void CheckFreeArguments(const CallExpr *E);
2214 
2215  void CheckReturnValExpr(Expr *RetValExp, QualType lhsType,
2216  SourceLocation ReturnLoc, bool isObjCMethod = false,
2217  const AttrVec *Attrs = nullptr,
2218  const FunctionDecl *FD = nullptr);
2219 
2220  void CheckImplicitConversions(Expr *E, SourceLocation CC = SourceLocation());
2221  void CheckBoolLikeConversion(Expr *E, SourceLocation CC);
2222  void CheckForIntOverflow(const Expr *E);
2223  void CheckUnsequencedOperations(const Expr *E);
2224 
2225  /// Perform semantic checks on a completed expression. This will either
2226  /// be a full-expression or a default argument expression.
2227  void CheckCompletedExpr(Expr *E, SourceLocation CheckLoc = SourceLocation(),
2228  bool IsConstexpr = false);
2229 
2230  void CheckBitFieldInitialization(SourceLocation InitLoc, FieldDecl *Field,
2231  Expr *Init);
2232  /// Check whether receiver is mutable ObjC container which
2233  /// attempts to add itself into the container
2234  void CheckObjCCircularContainer(ObjCMessageExpr *Message);
2235 
2236  void CheckTCBEnforcement(const SourceLocation CallExprLoc,
2237  const NamedDecl *Callee);
2238 
2239  /// A map from magic value to type information.
2240  std::unique_ptr<llvm::DenseMap<TypeTagMagicValue, TypeTagData>>
2241  TypeTagForDatatypeMagicValues;
2242 
2243  /// Peform checks on a call of a function with argument_with_type_tag
2244  /// or pointer_with_type_tag attributes.
2245  void CheckArgumentWithTypeTag(const ArgumentWithTypeTagAttr *Attr,
2246  const ArrayRef<const Expr *> ExprArgs,
2247  SourceLocation CallSiteLoc);
2248 
2249  /// Check if we are taking the address of a packed field
2250  /// as this may be a problem if the pointer value is dereferenced.
2251  void CheckAddressOfPackedMember(Expr *rhs);
2252 
2253  /// Helper class that collects misaligned member designations and
2254  /// their location info for delayed diagnostics.
2255  struct MisalignedMember {
2256  Expr *E;
2257  RecordDecl *RD;
2258  ValueDecl *MD;
2259  CharUnits Alignment;
2260 
2261  MisalignedMember() : E(), RD(), MD() {}
2262  MisalignedMember(Expr *E, RecordDecl *RD, ValueDecl *MD,
2263  CharUnits Alignment)
2264  : E(E), RD(RD), MD(MD), Alignment(Alignment) {}
2265  explicit MisalignedMember(Expr *E)
2266  : MisalignedMember(E, nullptr, nullptr, CharUnits()) {}
2267 
2268  bool operator==(const MisalignedMember &m) { return this->E == m.E; }
2269  };
2270  /// Small set of gathered accesses to potentially misaligned members
2271  /// due to the packed attribute.
2272  SmallVector<MisalignedMember, 4> MisalignedMembers;
2273 
2274  /// Adds an expression to the set of gathered misaligned members.
2275  void AddPotentialMisalignedMembers(Expr *E, RecordDecl *RD, ValueDecl *MD,
2276  CharUnits Alignment);
2277 
2278  bool CheckIntelFPGARegBuiltinFunctionCall(unsigned BuiltinID, CallExpr *Call);
2279  bool CheckIntelFPGAMemBuiltinFunctionCall(CallExpr *Call);
2280  bool CheckIntelSYCLPtrAnnotationBuiltinFunctionCall(unsigned BuiltinID,
2281  CallExpr *Call);
2282  bool CheckIntelSYCLAllocaBuiltinFunctionCall(unsigned BuiltinID,
2283  CallExpr *Call);
2284  ///@}
2285 
2286  //
2287  //
2288  // -------------------------------------------------------------------------
2289  //
2290  //
2291 
2292  /// \name C++ Coroutines
2293  /// Implementations are in SemaCoroutine.cpp
2294  ///@{
2295 
2296 public:
2297  /// The C++ "std::coroutine_traits" template, which is defined in
2298  /// <coroutine_traits>
2300 
2302  StringRef Keyword);
2306 
2309  UnresolvedLookupExpr *Lookup);
2311  Expr *Awaiter, bool IsImplicit = false);
2313  UnresolvedLookupExpr *Lookup);
2316  bool IsImplicit = false);
2320  void CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body);
2321 
2322  // As a clang extension, enforces that a non-coroutine function must be marked
2323  // with [[clang::coro_wrapper]] if it returns a type marked with
2324  // [[clang::coro_return_type]].
2325  // Expects that FD is not a coroutine.
2327  /// Lookup 'coroutine_traits' in std namespace and std::experimental
2328  /// namespace. The namespace found is recorded in Namespace.
2330  SourceLocation FuncLoc);
2331  /// Check that the expression co_await promise.final_suspend() shall not be
2332  /// potentially-throwing.
2333  bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend);
2334 
2335  ///@}
2336 
2337  //
2338  //
2339  // -------------------------------------------------------------------------
2340  //
2341  //
2342 
2343  /// \name C++ Scope Specifiers
2344  /// Implementations are in SemaCXXScopeSpec.cpp
2345  ///@{
2346 
2347 public:
2348  // Marks SS invalid if it represents an incomplete type.
2350  // Complete an enum decl, maybe without a scope spec.
2352  CXXScopeSpec *SS = nullptr);
2353 
2356  bool EnteringContext = false);
2357  bool isDependentScopeSpecifier(const CXXScopeSpec &SS);
2359 
2360  /// The parser has parsed a global nested-name-specifier '::'.
2361  ///
2362  /// \param CCLoc The location of the '::'.
2363  ///
2364  /// \param SS The nested-name-specifier, which will be updated in-place
2365  /// to reflect the parsed nested-name-specifier.
2366  ///
2367  /// \returns true if an error occurred, false otherwise.
2369 
2370  /// The parser has parsed a '__super' nested-name-specifier.
2371  ///
2372  /// \param SuperLoc The location of the '__super' keyword.
2373  ///
2374  /// \param ColonColonLoc The location of the '::'.
2375  ///
2376  /// \param SS The nested-name-specifier, which will be updated in-place
2377  /// to reflect the parsed nested-name-specifier.
2378  ///
2379  /// \returns true if an error occurred, false otherwise.
2381  SourceLocation ColonColonLoc, CXXScopeSpec &SS);
2382 
2384  bool *CanCorrect = nullptr);
2386 
2387  /// Keeps information about an identifier in a nested-name-spec.
2388  ///
2390  /// The type of the object, if we're parsing nested-name-specifier in
2391  /// a member access expression.
2393 
2394  /// The identifier preceding the '::'.
2396 
2397  /// The location of the identifier.
2399 
2400  /// The location of the '::'.
2402 
2403  /// Creates info object for the most typical case.
2405  SourceLocation ColonColonLoc,
2406  ParsedType ObjectType = ParsedType())
2407  : ObjectType(ObjectType), Identifier(II), IdentifierLoc(IdLoc),
2408  CCLoc(ColonColonLoc) {}
2409 
2411  SourceLocation ColonColonLoc, QualType ObjectType)
2412  : ObjectType(ParsedType::make(ObjectType)), Identifier(II),
2413  IdentifierLoc(IdLoc), CCLoc(ColonColonLoc) {}
2414  };
2415 
2416  bool BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo,
2417  bool EnteringContext, CXXScopeSpec &SS,
2418  NamedDecl *ScopeLookupResult,
2419  bool ErrorRecoveryLookup,
2420  bool *IsCorrectedToColon = nullptr,
2421  bool OnlyNamespace = false);
2422 
2423  /// The parser has parsed a nested-name-specifier 'identifier::'.
2424  ///
2425  /// \param S The scope in which this nested-name-specifier occurs.
2426  ///
2427  /// \param IdInfo Parser information about an identifier in the
2428  /// nested-name-spec.
2429  ///
2430  /// \param EnteringContext Whether we're entering the context nominated by
2431  /// this nested-name-specifier.
2432  ///
2433  /// \param SS The nested-name-specifier, which is both an input
2434  /// parameter (the nested-name-specifier before this type) and an
2435  /// output parameter (containing the full nested-name-specifier,
2436  /// including this new type).
2437  ///
2438  /// \param IsCorrectedToColon If not null, suggestions to replace '::' -> ':'
2439  /// are allowed. The bool value pointed by this parameter is set to 'true'
2440  /// if the identifier is treated as if it was followed by ':', not '::'.
2441  ///
2442  /// \param OnlyNamespace If true, only considers namespaces in lookup.
2443  ///
2444  /// \returns true if an error occurred, false otherwise.
2445  bool ActOnCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo,
2446  bool EnteringContext, CXXScopeSpec &SS,
2447  bool *IsCorrectedToColon = nullptr,
2448  bool OnlyNamespace = false);
2449 
2450  /// The parser has parsed a nested-name-specifier
2451  /// 'template[opt] template-name < template-args >::'.
2452  ///
2453  /// \param S The scope in which this nested-name-specifier occurs.
2454  ///
2455  /// \param SS The nested-name-specifier, which is both an input
2456  /// parameter (the nested-name-specifier before this type) and an
2457  /// output parameter (containing the full nested-name-specifier,
2458  /// including this new type).
2459  ///
2460  /// \param TemplateKWLoc the location of the 'template' keyword, if any.
2461  /// \param TemplateName the template name.
2462  /// \param TemplateNameLoc The location of the template name.
2463  /// \param LAngleLoc The location of the opening angle bracket ('<').
2464  /// \param TemplateArgs The template arguments.
2465  /// \param RAngleLoc The location of the closing angle bracket ('>').
2466  /// \param CCLoc The location of the '::'.
2467  ///
2468  /// \param EnteringContext Whether we're entering the context of the
2469  /// nested-name-specifier.
2470  ///
2471  ///
2472  /// \returns true if an error occurred, false otherwise.
2474  Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
2475  TemplateTy TemplateName, SourceLocation TemplateNameLoc,
2476  SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs,
2477  SourceLocation RAngleLoc, SourceLocation CCLoc, bool EnteringContext);
2478 
2480  SourceLocation ColonColonLoc);
2481 
2483  const DeclSpec &DS,
2484  SourceLocation ColonColonLoc,
2485  QualType Type);
2486 
2488  NestedNameSpecInfo &IdInfo,
2489  bool EnteringContext);
2490 
2491  /// Given a C++ nested-name-specifier, produce an annotation value
2492  /// that the parser can use later to reconstruct the given
2493  /// nested-name-specifier.
2494  ///
2495  /// \param SS A nested-name-specifier.
2496  ///
2497  /// \returns A pointer containing all of the information in the
2498  /// nested-name-specifier \p SS.
2500 
2501  /// Given an annotation pointer for a nested-name-specifier, restore
2502  /// the nested-name-specifier structure.
2503  ///
2504  /// \param Annotation The annotation pointer, produced by
2505  /// \c SaveNestedNameSpecifierAnnotation().
2506  ///
2507  /// \param AnnotationRange The source range corresponding to the annotation.
2508  ///
2509  /// \param SS The nested-name-specifier that will be updated with the contents
2510  /// of the annotation pointer.
2511  void RestoreNestedNameSpecifierAnnotation(void *Annotation,
2512  SourceRange AnnotationRange,
2513  CXXScopeSpec &SS);
2514 
2515  bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
2516 
2517  /// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global
2518  /// scope or nested-name-specifier) is parsed, part of a declarator-id.
2519  /// After this method is called, according to [C++ 3.4.3p3], names should be
2520  /// looked up in the declarator-id's scope, until the declarator is parsed and
2521  /// ActOnCXXExitDeclaratorScope is called.
2522  /// The 'SS' should be a non-empty valid CXXScopeSpec.
2524 
2525  /// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
2526  /// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same
2527  /// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.
2528  /// Used to indicate that names should revert to being looked up in the
2529  /// defining scope.
2530  void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
2531 
2532  ///@}
2533 
2534  //
2535  //
2536  // -------------------------------------------------------------------------
2537  //
2538  //
2539 
2540  /// \name Declarations
2541  /// Implementations are in SemaDecl.cpp
2542  ///@{
2543 
2544 public:
2546 
2547  /// The index of the first InventedParameterInfo that refers to the current
2548  /// context.
2550 
2551  /// A RAII object to temporarily push a declaration context.
2552  class ContextRAII {
2553  private:
2554  Sema &S;
2555  DeclContext *SavedContext;
2556  ProcessingContextState SavedContextState;
2557  QualType SavedCXXThisTypeOverride;
2558  unsigned SavedFunctionScopesStart;
2559  unsigned SavedInventedParameterInfosStart;
2560 
2561  public:
2562  ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext = true)
2563  : S(S), SavedContext(S.CurContext),
2564  SavedContextState(S.DelayedDiagnostics.pushUndelayed()),
2565  SavedCXXThisTypeOverride(S.CXXThisTypeOverride),
2566  SavedFunctionScopesStart(S.FunctionScopesStart),
2567  SavedInventedParameterInfosStart(S.InventedParameterInfosStart) {
2568  assert(ContextToPush && "pushing null context");
2569  S.CurContext = ContextToPush;
2570  if (NewThisContext)
2571  S.CXXThisTypeOverride = QualType();
2572  // Any saved FunctionScopes do not refer to this context.
2573  S.FunctionScopesStart = S.FunctionScopes.size();
2574  S.InventedParameterInfosStart = S.InventedParameterInfos.size();
2575  }
2576 
2577  void pop() {
2578  if (!SavedContext)
2579  return;
2580  S.CurContext = SavedContext;
2581  S.DelayedDiagnostics.popUndelayed(SavedContextState);
2582  S.CXXThisTypeOverride = SavedCXXThisTypeOverride;
2583  S.FunctionScopesStart = SavedFunctionScopesStart;
2584  S.InventedParameterInfosStart = SavedInventedParameterInfosStart;
2585  SavedContext = nullptr;
2586  }
2587 
2588  ~ContextRAII() { pop(); }
2589  };
2590 
2591  void DiagnoseInvalidJumps(Stmt *Body);
2592 
2593  /// The function definitions which were renamed as part of typo-correction
2594  /// to match their respective declarations. We want to keep track of them
2595  /// to ensure that we don't emit a "redefinition" error if we encounter a
2596  /// correctly named definition after the renamed definition.
2598 
2599  /// A cache of the flags available in enumerations with the flag_bits
2600  /// attribute.
2601  mutable llvm::DenseMap<const EnumDecl *, llvm::APInt> FlagBitsCache;
2602 
2603  /// WeakUndeclaredIdentifiers - Identifiers contained in \#pragma weak before
2604  /// declared. Rare. May alias another identifier, declared or undeclared.
2605  ///
2606  /// For aliases, the target identifier is used as a key for eventual
2607  /// processing when the target is declared. For the single-identifier form,
2608  /// the sole identifier is used as the key. Each entry is a `SetVector`
2609  /// (ordered by parse order) of aliases (identified by the alias name) in case
2610  /// of multiple aliases to the same undeclared identifier.
2611  llvm::MapVector<
2612  IdentifierInfo *,
2613  llvm::SetVector<
2615  llvm::SmallDenseSet<WeakInfo, 2u, WeakInfo::DenseMapInfoByAliasOnly>>>
2617 
2618  /// ExtnameUndeclaredIdentifiers - Identifiers contained in
2619  /// \#pragma redefine_extname before declared. Used in Solaris system headers
2620  /// to define functions that occur in multiple standards to call the version
2621  /// in the currently selected standard.
2622  llvm::DenseMap<IdentifierInfo *, AsmLabelAttr *> ExtnameUndeclaredIdentifiers;
2623 
2624  /// Set containing all typedefs that are likely unused.
2627 
2628  typedef LazyVector<const DeclaratorDecl *, ExternalSemaSource,
2631 
2632  /// The set of file scoped decls seen so far that have not been used
2633  /// and must warn if not used. Only contains the first declaration.
2635 
2639 
2640  /// All the tentative definitions encountered in the TU.
2642 
2643  /// All the external declarations encoutered and used in the TU.
2645 
2646  /// Generally null except when we temporarily switch decl contexts,
2647  /// like in \see ActOnObjCTemporaryExitContainerContext.
2649 
2650  /// Is the module scope we are in a C++ Header Unit?
2652  return ModuleScopes.empty() ? false
2653  : ModuleScopes.back().Module->isHeaderUnit();
2654  }
2655 
2656  /// Get the module owning an entity.
2657  Module *getOwningModule(const Decl *Entity) {
2658  return Entity->getOwningModule();
2659  }
2660 
2661  DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType = nullptr);
2662 
2664  Scope *S, CXXScopeSpec *SS = nullptr,
2665  bool isClassName = false, bool HasTrailingDot = false,
2666  ParsedType ObjectType = nullptr,
2667  bool IsCtorOrDtorName = false,
2668  bool WantNontrivialTypeSourceInfo = false,
2669  bool IsClassTemplateDeductionContext = true,
2670  ImplicitTypenameContext AllowImplicitTypename =
2672  IdentifierInfo **CorrectedII = nullptr);
2674  bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S);
2676  Scope *S, CXXScopeSpec *SS,
2677  ParsedType &SuggestedType,
2678  bool IsTemplateName = false);
2679 
2680  /// Attempt to behave like MSVC in situations where lookup of an unqualified
2681  /// type name has failed in a dependent context. In these situations, we
2682  /// automatically form a DependentTypeName that will retry lookup in a related
2683  /// scope during instantiation.
2685  SourceLocation NameLoc,
2686  bool IsTemplateTypeArg);
2687 
2688  /// Describes the result of the name lookup and resolution performed
2689  /// by \c ClassifyName().
2691  /// This name is not a type or template in this context, but might be
2692  /// something else.
2694  /// Classification failed; an error has been produced.
2696  /// The name has been typo-corrected to a keyword.
2698  /// The name was classified as a type.
2700  /// The name was classified as a specific non-type, non-template
2701  /// declaration. ActOnNameClassifiedAsNonType should be called to
2702  /// convert the declaration to an expression.
2704  /// The name was classified as an ADL-only function name.
2705  /// ActOnNameClassifiedAsUndeclaredNonType should be called to convert the
2706  /// result to an expression.
2708  /// The name denotes a member of a dependent type that could not be
2709  /// resolved. ActOnNameClassifiedAsDependentNonType should be called to
2710  /// convert the result to an expression.
2712  /// The name was classified as an overload set, and an expression
2713  /// representing that overload set has been formed.
2714  /// ActOnNameClassifiedAsOverloadSet should be called to form a suitable
2715  /// expression referencing the overload set.
2717  /// The name was classified as a template whose specializations are types.
2719  /// The name was classified as a variable template name.
2721  /// The name was classified as a function template name.
2723  /// The name was classified as an ADL-only function template name.
2725  /// The name was classified as a concept name.
2727  };
2728 
2731  union {
2736  };
2737 
2739 
2740  public:
2742 
2744 
2746 
2749  }
2750 
2753  Result.Expr = E;
2754  return Result;
2755  }
2756 
2759  Result.NonTypeDecl = D;
2760  return Result;
2761  }
2762 
2765  }
2766 
2769  }
2770 
2773  Result.Template = Name;
2774  return Result;
2775  }
2776 
2779  Result.Template = Name;
2780  return Result;
2781  }
2782 
2785  Result.Template = Name;
2786  return Result;
2787  }
2788 
2791  Result.Template = Name;
2792  return Result;
2793  }
2794 
2797  Result.Template = Name;
2798  return Result;
2799  }
2800 
2802 
2804  assert(Kind == NC_OverloadSet);
2805  return Expr;
2806  }
2807 
2809  assert(Kind == NC_Type);
2810  return Type;
2811  }
2812 
2814  assert(Kind == NC_NonType);
2815  return NonTypeDecl;
2816  }
2817 
2819  assert(Kind == NC_TypeTemplate || Kind == NC_FunctionTemplate ||
2820  Kind == NC_VarTemplate || Kind == NC_Concept ||
2822  return Template;
2823  }
2824 
2826  switch (Kind) {
2827  case NC_TypeTemplate:
2828  return TNK_Type_template;
2829  case NC_FunctionTemplate:
2830  return TNK_Function_template;
2831  case NC_VarTemplate:
2832  return TNK_Var_template;
2833  case NC_Concept:
2834  return TNK_Concept_template;
2835  case NC_UndeclaredTemplate:
2836  return TNK_Undeclared_template;
2837  default:
2838  llvm_unreachable("unsupported name classification.");
2839  }
2840  }
2841  };
2842 
2843  /// Perform name lookup on the given name, classifying it based on
2844  /// the results of name lookup and the following token.
2845  ///
2846  /// This routine is used by the parser to resolve identifiers and help direct
2847  /// parsing. When the identifier cannot be found, this routine will attempt
2848  /// to correct the typo and classify based on the resulting name.
2849  ///
2850  /// \param S The scope in which we're performing name lookup.
2851  ///
2852  /// \param SS The nested-name-specifier that precedes the name.
2853  ///
2854  /// \param Name The identifier. If typo correction finds an alternative name,
2855  /// this pointer parameter will be updated accordingly.
2856  ///
2857  /// \param NameLoc The location of the identifier.
2858  ///
2859  /// \param NextToken The token following the identifier. Used to help
2860  /// disambiguate the name.
2861  ///
2862  /// \param CCC The correction callback, if typo correction is desired.
2863  NameClassification ClassifyName(Scope *S, CXXScopeSpec &SS,
2864  IdentifierInfo *&Name, SourceLocation NameLoc,
2865  const Token &NextToken,
2866  CorrectionCandidateCallback *CCC = nullptr);
2867 
2868  /// Act on the result of classifying a name as an undeclared (ADL-only)
2869  /// non-type declaration.
2871  SourceLocation NameLoc);
2872  /// Act on the result of classifying a name as an undeclared member of a
2873  /// dependent base class.
2875  IdentifierInfo *Name,
2876  SourceLocation NameLoc,
2877  bool IsAddressOfOperand);
2878  /// Act on the result of classifying a name as a specific non-type
2879  /// declaration.
2881  NamedDecl *Found,
2882  SourceLocation NameLoc,
2883  const Token &NextToken);
2884  /// Act on the result of classifying a name as an overload set.
2886 
2887  /// Describes the detailed kind of a template name. Used in diagnostics.
2889  ClassTemplate,
2890  FunctionTemplate,
2891  VarTemplate,
2892  AliasTemplate,
2893  TemplateTemplateParam,
2894  Concept,
2895  DependentTemplate
2896  };
2899 
2900  /// Determine whether it's plausible that E was intended to be a
2901  /// template-name.
2902  bool mightBeIntendedToBeTemplateName(ExprResult E, bool &Dependent) {
2903  if (!getLangOpts().CPlusPlus || E.isInvalid())
2904  return false;
2905  Dependent = false;
2906  if (auto *DRE = dyn_cast<DeclRefExpr>(E.get()))
2907  return !DRE->hasExplicitTemplateArgs();
2908  if (auto *ME = dyn_cast<MemberExpr>(E.get()))
2909  return !ME->hasExplicitTemplateArgs();
2910  Dependent = true;
2911  if (auto *DSDRE = dyn_cast<DependentScopeDeclRefExpr>(E.get()))
2912  return !DSDRE->hasExplicitTemplateArgs();
2913  if (auto *DSME = dyn_cast<CXXDependentScopeMemberExpr>(E.get()))
2914  return !DSME->hasExplicitTemplateArgs();
2915  // Any additional cases recognized here should also be handled by
2916  // diagnoseExprIntendedAsTemplateName.
2917  return false;
2918  }
2919 
2920  void warnOnReservedIdentifier(const NamedDecl *D);
2921 
2923 
2925  MultiTemplateParamsArg TemplateParameterLists);
2927  SourceLocation Loc,
2928  unsigned FailedFoldDiagID);
2932  DeclarationName Name, SourceLocation Loc,
2933  TemplateIdAnnotation *TemplateId,
2934  bool IsMemberSpecialization);
2935 
2936  bool checkConstantPointerAuthKey(Expr *keyExpr, unsigned &key);
2937 
2938  void DiagnoseFunctionSpecifiers(const DeclSpec &DS);
2940  const LookupResult &R);
2943  const LookupResult &R);
2944  void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl,
2945  const LookupResult &R);
2946  void CheckShadow(Scope *S, VarDecl *D);
2947 
2948  /// Warn if 'E', which is an expression that is about to be modified, refers
2949  /// to a shadowing declaration.
2951 
2953 
2954  void handleTagNumbering(const TagDecl *Tag, Scope *TagScope);
2955  void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec,
2956  TypedefNameDecl *NewTD);
2959  TypeSourceInfo *TInfo,
2962  LookupResult &Previous, bool &Redeclaration);
2964  Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo,
2965  LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists,
2966  bool &AddToScope, ArrayRef<BindingDecl *> Bindings = std::nullopt);
2967 
2968  // Returns true if the variable declaration is a redeclaration
2972 
2974  TypeSourceInfo *TInfo,
2976  MultiTemplateParamsArg TemplateParamLists,
2977  bool &AddToScope);
2979 
2980  // Returns true if the function declaration is a redeclaration
2983  bool IsMemberSpecialization, bool DeclIsDefn);
2984  bool shouldLinkDependentDeclWithPrevious(Decl *D, Decl *OldDecl);
2986  QualType NewT, QualType OldT);
2987  void CheckMain(FunctionDecl *FD, const DeclSpec &D);
2990  bool IsDefinition);
2993  SourceLocation ExplicitThisLoc = {});
2994  ParmVarDecl *BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc,
2995  QualType T);
2996  QualType AdjustParameterTypeForObjCAutoRefCount(QualType T,
2997  SourceLocation NameLoc,
2998  TypeSourceInfo *TSInfo);
2999  ParmVarDecl *CheckParameter(DeclContext *DC, SourceLocation StartLoc,
3000  SourceLocation NameLoc,
3001  const IdentifierInfo *Name, QualType T,
3002  TypeSourceInfo *TSInfo, StorageClass SC);
3003 
3004  // Contexts where using non-trivial C union types can be disallowed. This is
3005  // passed to err_non_trivial_c_union_in_invalid_context.
3007  // Function parameter.
3009  // Function return.
3011  // Default-initialized object.
3013  // Variable with automatic storage duration.
3015  // Initializer expression that might copy from another object.
3017  // Assignment.
3019  // Compound literal.
3021  // Block capture.
3023  // lvalue-to-rvalue conversion of volatile type.
3025  };
3026 
3027  /// Emit diagnostics if the initializer or any of its explicit or
3028  /// implicitly-generated subexpressions require copying or
3029  /// default-initializing a type that is or contains a C union type that is
3030  /// non-trivial to copy or default-initialize.
3032 
3033  // These flags are passed to checkNonTrivialCUnion.
3035  NTCUK_Init = 0x1,
3037  NTCUK_Copy = 0x4,
3038  };
3039 
3040  /// Emit diagnostics if a non-trivial C union type or a struct that contains
3041  /// a non-trivial C union is used in an invalid context.
3043  NonTrivialCUnionContext UseContext,
3044  unsigned NonTrivialKind);
3045 
3046  void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit);
3047  void ActOnUninitializedDecl(Decl *dcl);
3048  void ActOnInitializerError(Decl *Dcl);
3049 
3050  void ActOnCXXForRangeDecl(Decl *D);
3052  IdentifierInfo *Ident,
3053  ParsedAttributes &Attrs);
3054 
3057  void FinalizeDeclaration(Decl *D);
3061 
3062  /// Should be called on all declarations that might have attached
3063  /// documentation comments.
3064  void ActOnDocumentableDecl(Decl *D);
3066 
3067  enum class FnBodyKind {
3068  /// C++26 [dcl.fct.def.general]p1
3069  /// function-body:
3070  /// ctor-initializer[opt] compound-statement
3071  /// function-try-block
3072  Other,
3073  /// = default ;
3074  Default,
3075  /// deleted-function-body
3076  ///
3077  /// deleted-function-body:
3078  /// = delete ;
3079  /// = delete ( unevaluated-string ) ;
3080  Delete
3081  };
3082 
3084  SourceLocation LocAfterDecls);
3086  FunctionDecl *FD, const FunctionDecl *EffectiveDefinition = nullptr,
3087  SkipBodyInfo *SkipBody = nullptr);
3089  MultiTemplateParamsArg TemplateParamLists,
3090  SkipBodyInfo *SkipBody = nullptr,
3091  FnBodyKind BodyKind = FnBodyKind::Other);
3093  SkipBodyInfo *SkipBody = nullptr,
3094  FnBodyKind BodyKind = FnBodyKind::Other);
3096 
3097  /// Determine whether we can delay parsing the body of a function or
3098  /// function template until it is used, assuming we don't care about emitting
3099  /// code for that function.
3100  ///
3101  /// This will be \c false if we may need the body of the function in the
3102  /// middle of parsing an expression (where it's impractical to switch to
3103  /// parsing a different function), for instance, if it's constexpr in C++11
3104  /// or has an 'auto' return type in C++14. These cases are essentially bugs.
3105  bool canDelayFunctionBody(const Declarator &D);
3106 
3107  /// Determine whether we can skip parsing the body of a function
3108  /// definition, assuming we don't care about analyzing its body or emitting
3109  /// code for that function.
3110  ///
3111  /// This will be \c false only if we may need the body of the function in
3112  /// order to parse the rest of the program (for instance, if it is
3113  /// \c constexpr in C++11 or has an 'auto' return type in C++14).
3114  bool canSkipFunctionBody(Decl *D);
3115 
3118  Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body, bool IsInstantiation);
3121 
3122  /// ActOnFinishDelayedAttribute - Invoked when we have finished parsing an
3123  /// attribute for which parsing is delayed.
3125 
3126  /// Diagnose any unused parameters in the given sequence of
3127  /// ParmVarDecl pointers.
3129 
3130  /// Diagnose whether the size of parameters or return value of a
3131  /// function or obj-c method definition is pass-by-value and larger than a
3132  /// specified threshold.
3133  void
3135  QualType ReturnTy, NamedDecl *D);
3136 
3138  SourceLocation RParenLoc);
3139 
3141  void ActOnFinishTopLevelStmtDecl(TopLevelStmtDecl *D, Stmt *Statement);
3142 
3143  void ActOnPopScope(SourceLocation Loc, Scope *S);
3144 
3146  const ParsedAttributesView &DeclAttrs,
3147  RecordDecl *&AnonRecord);
3149  const ParsedAttributesView &DeclAttrs,
3150  MultiTemplateParamsArg TemplateParams,
3151  bool IsExplicitInstantiation,
3152  RecordDecl *&AnonRecord);
3153 
3155  RecordDecl *Record,
3156  const PrintingPolicy &Policy);
3157 
3158  /// Called once it is known whether
3159  /// a tag declaration is an anonymous union or struct.
3161 
3163 
3165  RecordDecl *Record);
3166 
3167  /// Common ways to introduce type names without a tag for use in diagnostics.
3168  /// Keep in sync with err_tag_reference_non_tag.
3169  enum NonTagKind {
3179  };
3180 
3181  /// Given a non-tag type declaration, returns an enum useful for indicating
3182  /// what kind of non-tag type this is.
3184 
3186  bool isDefinition, SourceLocation NewTagLoc,
3187  const IdentifierInfo *Name);
3188 
3189  enum TagUseKind {
3190  TUK_Reference, // Reference to a tag: 'struct foo *X;'
3191  TUK_Declaration, // Fwd decl of a tag: 'struct foo;'
3192  TUK_Definition, // Definition of a tag: 'struct foo { int X; } Y;'
3193  TUK_Friend // Friend declaration: 'friend struct foo;'
3194  };
3195 
3197  // Not parsing a type within __builtin_offsetof.
3199  // Parsing a type within __builtin_offsetof.
3201  // Parsing a type within macro "offsetof", defined in __buitin_offsetof
3202  // To improve our diagnostic message.
3204  };
3205 
3206  DeclResult ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
3207  SourceLocation KWLoc, CXXScopeSpec &SS,
3208  IdentifierInfo *Name, SourceLocation NameLoc,
3210  SourceLocation ModulePrivateLoc,
3211  MultiTemplateParamsArg TemplateParameterLists,
3212  bool &OwnedDecl, bool &IsDependent,
3213  SourceLocation ScopedEnumKWLoc,
3214  bool ScopedEnumUsesClassTag, TypeResult UnderlyingType,
3215  bool IsTypeSpecifier, bool IsTemplateParamOrArg,
3216  OffsetOfKind OOK, SkipBodyInfo *SkipBody = nullptr);
3217 
3218  Decl *ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart,
3219  Declarator &D, Expr *BitfieldWidth);
3220 
3221  FieldDecl *HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart,
3222  Declarator &D, Expr *BitfieldWidth,
3223  InClassInitStyle InitStyle, AccessSpecifier AS);
3224 
3226  TypeSourceInfo *TInfo, RecordDecl *Record,
3227  SourceLocation Loc, bool Mutable,
3228  Expr *BitfieldWidth, InClassInitStyle InitStyle,
3230  NamedDecl *PrevDecl, Declarator *D = nullptr);
3231 
3232  bool CheckNontrivialField(FieldDecl *FD);
3233 
3234  void ActOnLastBitfield(SourceLocation DeclStart,
3235  SmallVectorImpl<Decl *> &AllIvarDecls);
3236  Decl *ActOnIvar(Scope *S, SourceLocation DeclStart, Declarator &D,
3237  Expr *BitWidth, tok::ObjCKeywordKind visibility);
3238 
3239  // This is used for both record definitions and ObjC interface declarations.
3240  void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl,
3241  ArrayRef<Decl *> Fields, SourceLocation LBrac,
3242  SourceLocation RBrac, const ParsedAttributesView &AttrList);
3243 
3244  /// ActOnTagStartDefinition - Invoked when we have entered the
3245  /// scope of a tag's definition (e.g., for an enumeration, class,
3246  /// struct, or union).
3248 
3249  /// Perform ODR-like check for C/ObjC when merging tag types from modules.
3250  /// Differently from C++, actually parse the body and reject / error out
3251  /// in case of a structural mismatch.
3252  bool ActOnDuplicateDefinition(Decl *Prev, SkipBodyInfo &SkipBody);
3253 
3255 
3256  /// Invoked when we enter a tag definition that we're skipping.
3258 
3260 
3261  /// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
3262  /// C++ record definition's base-specifiers clause and are starting its
3263  /// member declarations.
3265  SourceLocation FinalLoc,
3266  bool IsFinalSpelledSealed,
3267  bool IsAbstract,
3268  SourceLocation LBraceLoc);
3269 
3270  /// ActOnTagFinishDefinition - Invoked once we have finished parsing
3271  /// the definition of a tag (enumeration, class, struct, or union).
3273  SourceRange BraceRange);
3274 
3276 
3278 
3279  /// Invoked when we must temporarily exit the objective-c container
3280  /// scope for parsing/looking-up C constructs.
3281  ///
3282  /// Must be followed by a call to \see ActOnObjCReenterContainerContext
3285 
3286  /// ActOnTagDefinitionError - Invoked when there was an unrecoverable
3287  /// error parsing the definition of a tag.
3289 
3291  EnumConstantDecl *LastEnumConst,
3293  Expr *val);
3295  bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped,
3296  QualType EnumUnderlyingTy, bool IsFixed,
3297  const EnumDecl *Prev);
3298 
3299  /// Determine whether the body of an anonymous enumeration should be skipped.
3300  /// \param II The name of the first enumerator.
3302  SourceLocation IILoc);
3303 
3304  Decl *ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant,
3306  const ParsedAttributesView &Attrs,
3307  SourceLocation EqualLoc, Expr *Val);
3308  void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange,
3309  Decl *EnumDecl, ArrayRef<Decl *> Elements, Scope *S,
3310  const ParsedAttributesView &Attr);
3311 
3312  /// Set the current declaration context until it gets popped.
3313  void PushDeclContext(Scope *S, DeclContext *DC);
3314  void PopDeclContext();
3315 
3316  /// EnterDeclaratorContext - Used when we must lookup names in the context
3317  /// of a declarator's nested name specifier.
3319  void ExitDeclaratorContext(Scope *S);
3320 
3321  /// Enter a template parameter scope, after it's been associated with a
3322  /// particular DeclContext. Causes lookup within the scope to chain through
3323  /// enclosing contexts in the correct order.
3324  void EnterTemplatedContext(Scope *S, DeclContext *DC);
3325 
3326  /// Push the parameters of D, which must be a function, into scope.
3327  void ActOnReenterFunctionContext(Scope *S, Decl *D);
3328  void ActOnExitFunctionContext();
3329 
3330  /// Add this decl to the scope shadowed decl chains.
3331  void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext = true);
3332 
3333  /// isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true
3334  /// if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns
3335  /// true if 'D' belongs to the given declaration context.
3336  ///
3337  /// \param AllowInlineNamespace If \c true, allow the declaration to be in the
3338  /// enclosing namespace set of the context, rather than contained
3339  /// directly within it.
3340  bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S = nullptr,
3341  bool AllowInlineNamespace = false) const;
3342 
3343  /// Finds the scope corresponding to the given decl context, if it
3344  /// happens to be an enclosing scope. Otherwise return NULL.
3345  static Scope *getScopeForDeclContext(Scope *S, DeclContext *DC);
3346 
3347  /// Subroutines of ActOnDeclarator().
3349  TypeSourceInfo *TInfo);
3351 
3352  /// Describes the kind of merge to perform for availability
3353  /// attributes (including "deprecated", "unavailable", and "availability").
3355  /// Don't merge availability attributes at all.
3357  /// Merge availability attributes for a redeclaration, which requires
3358  /// an exact match.
3360  /// Merge availability attributes for an override, which requires
3361  /// an exact match or a weakening of constraints.
3363  /// Merge availability attributes for an implementation of
3364  /// a protocol requirement.
3366  /// Merge availability attributes for an implementation of
3367  /// an optional protocol requirement.
3369  };
3370 
3371  void mergeDeclAttributes(NamedDecl *New, Decl *Old,
3374  LookupResult &OldDecls);
3375  bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S,
3376  bool MergeTypeWithOld, bool NewDeclIsDefn);
3378  Scope *S, bool MergeTypeWithOld);
3381  void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld);
3382  bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn);
3383  void notePreviousDefinition(const NamedDecl *Old, SourceLocation New);
3384 
3386  bool ConsiderLinkage, bool AllowInlineNamespace);
3387 
3391  bool IsRedefinitionInModule(const NamedDecl *New, const NamedDecl *Old) const;
3392 
3393  bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const;
3394 
3395  /// If it's a file scoped decl that must warn if not used, keep track
3396  /// of it.
3398 
3399  typedef llvm::function_ref<void(SourceLocation Loc, PartialDiagnostic PD)>
3401 
3404  DiagReceiverTy DiagReceiver);
3405  void DiagnoseUnusedDecl(const NamedDecl *ND);
3406  void DiagnoseUnusedDecl(const NamedDecl *ND, DiagReceiverTy DiagReceiver);
3407 
3408  /// If VD is set but not otherwise used, diagnose, for a parameter or a
3409  /// variable.
3410  void DiagnoseUnusedButSetDecl(const VarDecl *VD, DiagReceiverTy DiagReceiver);
3411 
3413  SourceLocation IdLoc,
3414  bool TypoCorrection = false);
3415 
3417 
3419  SourceLocation Loc);
3421  bool ForRedeclaration, SourceLocation Loc);
3422 
3423  /// Get the outermost AttributedType node that sets a calling convention.
3424  /// Valid types should not have multiple attributes with different CCs.
3426 
3429 
3430  /// ParsingInitForAutoVars - a set of declarations with auto types for which
3431  /// we are currently parsing the initializer.
3433 
3434  /// Look for a locally scoped extern "C" declaration by the given name.
3436 
3438 
3440 
3441  static bool adjustContextForLocalExternDecl(DeclContext *&DC);
3442 
3444 
3445  /// Checks if the variant/multiversion functions are compatible.
3447  const FunctionDecl *OldFD, const FunctionDecl *NewFD,
3448  const PartialDiagnostic &NoProtoDiagID,
3449  const PartialDiagnosticAt &NoteCausedDiagIDAt,
3450  const PartialDiagnosticAt &NoSupportDiagIDAt,
3451  const PartialDiagnosticAt &DiffDiagIDAt, bool TemplatesSupported,
3452  bool ConstexprSupported, bool CLinkageMayDiffer);
3453 
3454  /// type checking declaration initializers (C99 6.7.8)
3456  Expr *Init, unsigned DiagID = diag::err_init_element_not_constant);
3457 
3460  SourceRange Range, bool DirectInit,
3461  Expr *Init);
3462 
3463  bool DeduceVariableDeclarationType(VarDecl *VDecl, bool DirectInit,
3464  Expr *Init);
3465 
3467 
3468  // Heuristically tells if the function is `get_return_object` member of a
3469  // coroutine promise_type by matching the function name.
3470  static bool CanBeGetReturnObject(const FunctionDecl *FD);
3471  static bool CanBeGetReturnTypeOnAllocFailure(const FunctionDecl *FD);
3472 
3474  Scope *S);
3476  FunctionDecl *FD);
3478 
3479  /// VerifyBitField - verifies that a bit field expression is an ICE and has
3480  /// the correct width, and that the field type is valid.
3481  /// Returns false on success.
3483  const IdentifierInfo *FieldName, QualType FieldTy,
3484  bool IsMsStruct, Expr *BitWidth);
3485 
3486  /// IsValueInFlagEnum - Determine if a value is allowed as part of a flag
3487  /// enum. If AllowMask is true, then we also allow the complement of a valid
3488  /// value, to be used as a mask.
3489  bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val,
3490  bool AllowMask) const;
3491 
3492  /// ActOnPragmaWeakID - Called on well formed \#pragma weak ident.
3493  void ActOnPragmaWeakID(IdentifierInfo *WeakName, SourceLocation PragmaLoc,
3494  SourceLocation WeakNameLoc);
3495 
3496  /// ActOnPragmaRedefineExtname - Called on well formed
3497  /// \#pragma redefine_extname oldname newname.
3499  IdentifierInfo *AliasName,
3500  SourceLocation PragmaLoc,
3501  SourceLocation WeakNameLoc,
3502  SourceLocation AliasNameLoc);
3503 
3504  /// ActOnPragmaWeakAlias - Called on well formed \#pragma weak ident = ident.
3505  void ActOnPragmaWeakAlias(IdentifierInfo *WeakName, IdentifierInfo *AliasName,
3506  SourceLocation PragmaLoc,
3507  SourceLocation WeakNameLoc,
3508  SourceLocation AliasNameLoc);
3509 
3511 
3512  /// Status of the function emission on the CUDA/HIP/OpenMP host/device attrs.
3514  Emitted,
3515  CUDADiscarded, // Discarded due to CUDA/HIP hostness
3516  OMPDiscarded, // Discarded due to OpenMP hostness
3517  TemplateDiscarded, // Discarded due to uninstantiated templates
3518  Unknown,
3519  };
3521  bool Final = false);
3522 
3523  // Whether the callee should be ignored in CUDA/HIP/OpenMP host/device check.
3525 
3527 
3528 private:
3529  /// Function or variable declarations to be checked for whether the deferred
3530  /// diagnostics should be emitted.
3531  llvm::SmallSetVector<Decl *, 4> DeclsToCheckForDeferredDiags;
3532 
3533  /// Map of current shadowing declarations to shadowed declarations. Warn if
3534  /// it looks like the user is trying to modify the shadowing declaration.
3535  llvm::DenseMap<const NamedDecl *, const NamedDecl *> ShadowingDecls;
3536 
3537  static bool mightHaveNonExternalLinkage(const DeclaratorDecl *FD);
3538 
3539  ///@}
3540 
3541  //
3542  //
3543  // -------------------------------------------------------------------------
3544  //
3545  //
3546 
3547  /// \name Declaration Attribute Handling
3548  /// Implementations are in SemaDeclAttr.cpp
3549  ///@{
3550 
3551 public:
3552  /// Describes the kind of priority given to an availability attribute.
3553  ///
3554  /// The sum of priorities deteremines the final priority of the attribute.
3555  /// The final priority determines how the attribute will be merged.
3556  /// An attribute with a lower priority will always remove higher priority
3557  /// attributes for the specified platform when it is being applied. An
3558  /// attribute with a higher priority will not be applied if the declaration
3559  /// already has an availability attribute with a lower priority for the
3560  /// specified platform. The final prirority values are not expected to match
3561  /// the values in this enumeration, but instead should be treated as a plain
3562  /// integer value. This enumeration just names the priority weights that are
3563  /// used to calculate that final vaue.
3565  /// The availability attribute was specified explicitly next to the
3566  /// declaration.
3568 
3569  /// The availability attribute was applied using '#pragma clang attribute'.
3571 
3572  /// The availability attribute for a specific platform was inferred from
3573  /// an availability attribute for another platform.
3575  };
3576 
3577  /// Describes the reason a calling convention specification was ignored, used
3578  /// for diagnostics.
3580  ForThisTarget = 0,
3582  ConstructorDestructor,
3583  BuiltinFunction
3584  };
3585 
3586  /// WeakTopLevelDecl - Translation-unit scoped declarations generated by
3587  /// \#pragma weak during processing of other Decls.
3588  /// I couldn't figure out a clean way to generate these in-line, so
3589  /// we store them here and handle separately -- which is a hack.
3590  /// It would be best to refactor this.
3592 
3593  /// WeakTopLevelDeclDecls - access to \#pragma weak-generated Decls
3595 
3599 
3600  /// ExtVectorDecls - This is a list all the extended vector types. This allows
3601  /// us to associate a raw vector type with one of the ext_vector type names.
3602  /// This is only necessary for issuing pretty diagnostics.
3604 
3606  const Expr *E, StringRef &Str,
3607  SourceLocation *ArgLocation = nullptr);
3608  bool checkStringLiteralArgumentAttr(const ParsedAttr &Attr, unsigned ArgNum,
3609  StringRef &Str,
3610  SourceLocation *ArgLocation = nullptr);
3611 
3612  /// Determine if type T is a valid subject for a nonnull and similar
3613  /// attributes. By default, we look through references (the behavior used by
3614  /// nonnull), but if the second parameter is true, then we treat a reference
3615  /// type as valid.
3616  bool isValidPointerAttrType(QualType T, bool RefOkay = false);
3617 
3618  /// AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular
3619  /// declaration.
3621  Expr *OE);
3622 
3623  /// AddAllocAlignAttr - Adds an alloc_align attribute to a particular
3624  /// declaration.
3626  Expr *ParamExpr);
3627 
3628  bool CheckAttrTarget(const ParsedAttr &CurrAttr);
3629  bool CheckAttrNoArgs(const ParsedAttr &CurrAttr);
3630 
3631  AvailabilityAttr *
3633  IdentifierInfo *Platform, bool Implicit,
3634  VersionTuple Introduced, VersionTuple Deprecated,
3635  VersionTuple Obsoleted, bool IsUnavailable,
3636  StringRef Message, bool IsStrict, StringRef Replacement,
3637  AvailabilityMergeKind AMK, int Priority);
3638  TypeVisibilityAttr *
3640  TypeVisibilityAttr::VisibilityType Vis);
3641  VisibilityAttr *mergeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI,
3642  VisibilityAttr::VisibilityType Vis);
3643  SectionAttr *mergeSectionAttr(Decl *D, const AttributeCommonInfo &CI,
3644  StringRef Name);
3645 
3646  llvm::Error isValidSectionSpecifier(StringRef Str);
3647  bool checkSectionName(SourceLocation LiteralLoc, StringRef Str);
3648  CodeSegAttr *mergeCodeSegAttr(Decl *D, const AttributeCommonInfo &CI,
3649  StringRef Name);
3650 
3651  bool checkTargetAttr(SourceLocation LiteralLoc, StringRef Str);
3653  StringRef &Str, bool &isDefault);
3655  SourceLocation LiteralLoc, StringRef Str, const StringLiteral *Literal,
3656  Decl *D, bool &HasDefault, bool &HasCommas, bool &HasNotDefault,
3657  SmallVectorImpl<SmallString<64>> &StringsBuffer);
3658 
3659  ErrorAttr *mergeErrorAttr(Decl *D, const AttributeCommonInfo &CI,
3660  StringRef NewUserDiagnostic);
3661  FormatAttr *mergeFormatAttr(Decl *D, const AttributeCommonInfo &CI,
3662  IdentifierInfo *Format, int FormatIdx,
3663  int FirstArg);
3664 
3665  /// AddAlignedAttr - Adds an aligned attribute to a particular declaration.
3667  bool IsPackExpansion);
3669  bool IsPackExpansion);
3670 
3671  /// AddAlignValueAttr - Adds an align_value attribute to a particular
3672  /// declaration.
3674 
3675  /// AddAnnotationAttr - Adds an annotation Annot with Args arguments to D.
3677  StringRef Annot, MutableArrayRef<Expr *> Args);
3678 
3680  bool BestCase,
3681  MSInheritanceModel SemanticSpelling);
3682 
3684 
3685  /// AddModeAttr - Adds a mode attribute to a particular declaration.
3687  bool InInstantiation = false);
3688  AlwaysInlineAttr *mergeAlwaysInlineAttr(Decl *D,
3689  const AttributeCommonInfo &CI,
3690  const IdentifierInfo *Ident);
3691  MinSizeAttr *mergeMinSizeAttr(Decl *D, const AttributeCommonInfo &CI);
3692  SwiftNameAttr *mergeSwiftNameAttr(Decl *D, const SwiftNameAttr &SNA,
3693  StringRef Name);
3694  OptimizeNoneAttr *mergeOptimizeNoneAttr(Decl *D,
3695  const AttributeCommonInfo &CI);
3696  InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D, const ParsedAttr &AL);
3697  InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D,
3698  const InternalLinkageAttr &AL);
3699 
3700  /// Check validaty of calling convention attribute \p attr. If \p FD
3701  /// is not null pointer, use \p FD to determine the CUDA/HIP host/device
3702  /// target. Otherwise, it is specified by \p CFT.
3704  const ParsedAttr &attr, CallingConv &CC, const FunctionDecl *FD = nullptr,
3706 
3708  ParameterABI ABI);
3709  bool CheckRegparmAttr(const ParsedAttr &attr, unsigned &value);
3710 
3711  /// Create an CUDALaunchBoundsAttr attribute.
3712  CUDALaunchBoundsAttr *CreateLaunchBoundsAttr(const AttributeCommonInfo &CI,
3713  Expr *MaxThreads,
3714  Expr *MinBlocks,
3715  Expr *MaxBlocks);
3716 
3717  /// AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular
3718  /// declaration.
3720  Expr *MaxThreads, Expr *MinBlocks, Expr *MaxBlocks);
3721 
3722  enum class RetainOwnershipKind { NS, CF, OS };
3724  RetainOwnershipKind K, bool IsTemplateInstantiation);
3725 
3727 
3728  /// Do a check to make sure \p Name looks like a legal argument for the
3729  /// swift_name attribute applied to decl \p D. Raise a diagnostic if the name
3730  /// is invalid for the given declaration.
3731  ///
3732  /// \p AL is used to provide caret diagnostics in case of a malformed name.
3733  ///
3734  /// \returns true if the name is a valid swift name for \p D, false otherwise.
3735  bool DiagnoseSwiftName(Decl *D, StringRef Name, SourceLocation Loc,
3736  const ParsedAttr &AL, bool IsAsync);
3737 
3738  UuidAttr *mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI,
3739  StringRef UuidAsWritten, MSGuidDecl *GuidDecl);
3740 
3741  BTFDeclTagAttr *mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL);
3742 
3743  WebAssemblyImportNameAttr *
3744  mergeImportNameAttr(Decl *D, const WebAssemblyImportNameAttr &AL);
3745  WebAssemblyImportModuleAttr *
3746  mergeImportModuleAttr(Decl *D, const WebAssemblyImportModuleAttr &AL);
3747 
3748  /// Create an AMDGPUWavesPerEUAttr attribute.
3749  AMDGPUFlatWorkGroupSizeAttr *
3751  Expr *Max);
3752 
3753  /// addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size
3754  /// attribute to a particular declaration.
3756  Expr *Min, Expr *Max);
3757 
3758  /// Create an AMDGPUWavesPerEUAttr attribute.
3759  AMDGPUWavesPerEUAttr *
3761  Expr *Max);
3762 
3763  /// addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a
3764  /// particular declaration.
3766  Expr *Min, Expr *Max);
3767 
3768  /// Create an AMDGPUMaxNumWorkGroupsAttr attribute.
3769  AMDGPUMaxNumWorkGroupsAttr *
3771  Expr *YExpr, Expr *ZExpr);
3772 
3773  /// addAMDGPUMaxNumWorkGroupsAttr - Adds an amdgpu_max_num_work_groups
3774  /// attribute to a particular declaration.
3776  Expr *XExpr, Expr *YExpr, Expr *ZExpr);
3777 
3778  DLLImportAttr *mergeDLLImportAttr(Decl *D, const AttributeCommonInfo &CI);
3779  DLLExportAttr *mergeDLLExportAttr(Decl *D, const AttributeCommonInfo &CI);
3780  MSInheritanceAttr *mergeMSInheritanceAttr(Decl *D,
3781  const AttributeCommonInfo &CI,
3782  bool BestCase,
3783  MSInheritanceModel Model);
3784 
3785  EnforceTCBAttr *mergeEnforceTCBAttr(Decl *D, const EnforceTCBAttr &AL);
3786  EnforceTCBLeafAttr *mergeEnforceTCBLeafAttr(Decl *D,
3787  const EnforceTCBLeafAttr &AL);
3788 
3789  // Helper for delayed processing of attributes.
3791  const ParsedAttributesView &AttrList);
3792 
3793  // Options for ProcessDeclAttributeList().
3796  : IncludeCXX11Attributes(true), IgnoreTypeAttributes(false) {}
3797 
3799  ProcessDeclAttributeOptions Result = *this;
3800  Result.IncludeCXX11Attributes = Val;
3801  return Result;
3802  }
3803 
3805  ProcessDeclAttributeOptions Result = *this;
3806  Result.IgnoreTypeAttributes = Val;
3807  return Result;
3808  }
3809 
3810  // Should C++11 attributes be processed?
3812 
3813  // Should any type attributes encountered be ignored?
3814  // If this option is false, a diagnostic will be emitted for any type
3815  // attributes of a kind that does not "slide" from the declaration to
3816  // the decl-specifier-seq.
3818  };
3819 
3821  const ParsedAttributesView &AttrList,
3822  const ProcessDeclAttributeOptions &Options =
3825  const ParsedAttributesView &AttrList);
3826 
3828 
3830  SourceLocation Loc);
3831  void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, const WeakInfo &W);
3832 
3834  // Decl attributes - this routine is the top level dispatcher.
3835  void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD);
3836 
3837 public:
3838 
3840 
3842 
3844 
3846  Expr **Exprs, unsigned Size);
3847  bool AnyWorkGroupSizesDiffer(const Expr *LHSXDim, const Expr *LHSYDim,
3848  const Expr *LHSZDim, const Expr *RHSXDim,
3849  const Expr *RHSYDim, const Expr *RHSZDim);
3850  bool AllWorkGroupSizesSame(const Expr *LHSXDim, const Expr *LHSYDim,
3851  const Expr *LHSZDim, const Expr *RHSXDim,
3852  const Expr *RHSYDim, const Expr *RHSZDim);
3854  Expr *XDim, Expr *YDim, Expr *ZDim);
3855  SYCLWorkGroupSizeHintAttr *
3856  MergeSYCLWorkGroupSizeHintAttr(Decl *D, const SYCLWorkGroupSizeHintAttr &A);
3858  Expr *E);
3859  IntelReqdSubGroupSizeAttr *
3860  MergeIntelReqdSubGroupSizeAttr(Decl *D, const IntelReqdSubGroupSizeAttr &A);
3861  IntelNamedSubGroupSizeAttr *
3862  MergeIntelNamedSubGroupSizeAttr(Decl *D, const IntelNamedSubGroupSizeAttr &A);
3864  Expr *E);
3865  SYCLIntelNumSimdWorkItemsAttr *
3867  const SYCLIntelNumSimdWorkItemsAttr &A);
3869  Expr *E);
3870  SYCLIntelESimdVectorizeAttr *
3872  const SYCLIntelESimdVectorizeAttr &A);
3874  const AttributeCommonInfo &CI,
3875  Expr *E);
3876  SYCLIntelSchedulerTargetFmaxMhzAttr *MergeSYCLIntelSchedulerTargetFmaxMhzAttr(
3877  Decl *D, const SYCLIntelSchedulerTargetFmaxMhzAttr &A);
3879  const AttributeCommonInfo &CI,
3880  Expr *E);
3881  SYCLIntelNoGlobalWorkOffsetAttr *MergeSYCLIntelNoGlobalWorkOffsetAttr(
3882  Decl *D, const SYCLIntelNoGlobalWorkOffsetAttr &A);
3884  Expr *E);
3885  SYCLIntelLoopFuseAttr *
3886  MergeSYCLIntelLoopFuseAttr(Decl *D, const SYCLIntelLoopFuseAttr &A);
3888  Expr *E);
3890  Expr *E);
3891  SYCLIntelMaxReplicatesAttr *
3892  MergeSYCLIntelMaxReplicatesAttr(Decl *D, const SYCLIntelMaxReplicatesAttr &A);
3894  Expr *E);
3895  SYCLIntelForcePow2DepthAttr *
3897  const SYCLIntelForcePow2DepthAttr &A);
3899  const AttributeCommonInfo &CI,
3900  Expr *E);
3901  SYCLIntelInitiationIntervalAttr *MergeSYCLIntelInitiationIntervalAttr(
3902  Decl *D, const SYCLIntelInitiationIntervalAttr &A);
3903 
3904  SYCLIntelMaxConcurrencyAttr *
3906  const SYCLIntelMaxConcurrencyAttr &A);
3908  Expr *E);
3909  SYCLIntelMaxGlobalWorkDimAttr *
3911  const SYCLIntelMaxGlobalWorkDimAttr &A);
3913  Decl *D, const AttributeCommonInfo &CI, Expr *E);
3914  SYCLIntelMinWorkGroupsPerComputeUnitAttr *
3916  Decl *D, const SYCLIntelMinWorkGroupsPerComputeUnitAttr &A);
3918  Decl *D, const AttributeCommonInfo &CI, Expr *E);
3919  SYCLIntelMaxWorkGroupsPerMultiprocessorAttr *
3921  Decl *D, const SYCLIntelMaxWorkGroupsPerMultiprocessorAttr &A);
3923  Expr *E);
3924  SYCLIntelBankWidthAttr *
3925  MergeSYCLIntelBankWidthAttr(Decl *D, const SYCLIntelBankWidthAttr &A);
3927  Expr *E);
3928  SYCLIntelNumBanksAttr *
3929  MergeSYCLIntelNumBanksAttr(Decl *D, const SYCLIntelNumBanksAttr &A);
3930  SYCLDeviceHasAttr *MergeSYCLDeviceHasAttr(Decl *D,
3931  const SYCLDeviceHasAttr &A);
3933  Expr **Exprs, unsigned Size);
3934  SYCLUsesAspectsAttr *MergeSYCLUsesAspectsAttr(Decl *D,
3935  const SYCLUsesAspectsAttr &A);
3937  Expr **Exprs, unsigned Size);
3938  bool CheckMaxAllowedWorkGroupSize(const Expr *RWGSXDim, const Expr *RWGSYDim,
3939  const Expr *RWGSZDim, const Expr *MWGSXDim,
3940  const Expr *MWGSYDim, const Expr *MWGSZDim);
3942  Expr *XDim, Expr *YDim, Expr *ZDim);
3943  SYCLIntelMaxWorkGroupSizeAttr *
3945  const SYCLIntelMaxWorkGroupSizeAttr &A);
3947  SYCLAddIRAttributesFunctionAttr *MergeSYCLAddIRAttributesFunctionAttr(
3948  Decl *D, const SYCLAddIRAttributesFunctionAttr &A);
3950  const AttributeCommonInfo &CI,
3952  SYCLAddIRAttributesKernelParameterAttr *
3954  Decl *D, const SYCLAddIRAttributesKernelParameterAttr &A);
3956  const AttributeCommonInfo &CI,
3958  SYCLAddIRAttributesGlobalVariableAttr *
3960  Decl *D, const SYCLAddIRAttributesGlobalVariableAttr &A);
3962  const AttributeCommonInfo &CI,
3964  SYCLAddIRAnnotationsMemberAttr *
3966  const SYCLAddIRAnnotationsMemberAttr &A);
3970  Expr *XDim, Expr *YDim, Expr *ZDim);
3971  SYCLReqdWorkGroupSizeAttr *
3972  MergeSYCLReqdWorkGroupSizeAttr(Decl *D, const SYCLReqdWorkGroupSizeAttr &A);
3973 
3974  SYCLTypeAttr *MergeSYCLTypeAttr(Decl *D, const AttributeCommonInfo &CI,
3975  SYCLTypeAttr::SYCLType TypeName);
3976 
3977  /// Emit a diagnostic about the given attribute having a deprecated name, and
3978  /// also emit a fixit hint to generate the new attribute name.
3979  void DiagnoseDeprecatedAttribute(const ParsedAttr &A, StringRef NewScope,
3980  StringRef NewName);
3981 
3982  /// Diagnoses an attribute in the 'intelfpga' namespace and suggests using
3983  /// the attribute in the 'intel' namespace instead.
3985  StringRef NewName = "");
3986 
3987  /// addSYCLIntelPipeIOAttr - Adds a pipe I/O attribute to a particular
3988  /// declaration.
3990  SYCLIntelPipeIOAttr *MergeSYCLIntelPipeIOAttr(Decl *D,
3991  const SYCLIntelPipeIOAttr &A);
3992 
3993  /// AddSYCLIntelMaxConcurrencyAttr - Adds a max_concurrency attribute to a
3994  /// particular declaration.
3996  Expr *E);
3997 
3999 
4000  ///@}
4001 
4002  //
4003  //
4004  // -------------------------------------------------------------------------
4005  //
4006  //
4007 
4008  /// \name C++ Declarations
4009  /// Implementations are in SemaDeclCXX.cpp
4010  ///@{
4011 
4012 public:
4014 
4015  /// Called before parsing a function declarator belonging to a function
4016  /// declaration.
4018  unsigned TemplateParameterDepth);
4019 
4020  /// Called after parsing a function declarator belonging to a function
4021  /// declaration.
4023 
4024  // Act on C++ namespaces
4026  SourceLocation NamespaceLoc,
4027  SourceLocation IdentLoc, IdentifierInfo *Ident,
4028  SourceLocation LBrace,
4029  const ParsedAttributesView &AttrList,
4030  UsingDirectiveDecl *&UsingDecl, bool IsNested);
4031  void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace);
4032 
4033  NamespaceDecl *getStdNamespace() const;
4035 
4036  CXXRecordDecl *getStdBadAlloc() const;
4037  EnumDecl *getStdAlignValT() const;
4038 
4040  const IdentifierInfo *MemberOrBase);
4041 
4043  /// The '<=>' operator was used in an expression and a builtin operator
4044  /// was selected.
4045  OperatorInExpression,
4046  /// A defaulted 'operator<=>' needed the comparison category. This
4047  /// typically only applies to 'std::strong_ordering', due to the implicit
4048  /// fallback return value.
4049  DefaultedOperator,
4050  };
4051 
4052  /// Lookup the specified comparison category types in the standard
4053  /// library, an check the VarDecls possibly returned by the operator<=>
4054  /// builtins for that type.
4055  ///
4056  /// \return The type of the comparison category type corresponding to the
4057  /// specified Kind, or a null type if an error occurs
4059  SourceLocation Loc,
4060  ComparisonCategoryUsage Usage);
4061 
4062  /// Tests whether Ty is an instance of std::initializer_list and, if
4063  /// it is and Element is not NULL, assigns the element type to Element.
4064  bool isStdInitializerList(QualType Ty, QualType *Element);
4065 
4066  /// Looks for the std::initializer_list template and instantiates it
4067  /// with Element, or emits an error if it's not found.
4068  ///
4069  /// \returns The instantiated template, or null on error.
4071 
4072  /// Determine whether Ctor is an initializer-list constructor, as
4073  /// defined in [dcl.init.list]p2.
4074  bool isInitListConstructor(const FunctionDecl *Ctor);
4075 
4076  Decl *ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc,
4077  SourceLocation NamespcLoc, CXXScopeSpec &SS,
4078  SourceLocation IdentLoc,
4079  IdentifierInfo *NamespcName,
4080  const ParsedAttributesView &AttrList);
4081 
4083 
4084  Decl *ActOnNamespaceAliasDef(Scope *CurScope, SourceLocation NamespaceLoc,
4085  SourceLocation AliasLoc, IdentifierInfo *Alias,
4086  CXXScopeSpec &SS, SourceLocation IdentLoc,
4087  IdentifierInfo *Ident);
4088 
4089  void FilterUsingLookup(Scope *S, LookupResult &lookup);
4090  void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow);
4092  const LookupResult &PreviousDecls,
4093  UsingShadowDecl *&PrevShadow);
4095  NamedDecl *Target,
4096  UsingShadowDecl *PrevDecl);
4097 
4099  bool HasTypenameKeyword,
4100  const CXXScopeSpec &SS,
4101  SourceLocation NameLoc,
4102  const LookupResult &Previous);
4103  bool CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename,
4104  const CXXScopeSpec &SS,
4105  const DeclarationNameInfo &NameInfo,
4106  SourceLocation NameLoc,
4107  const LookupResult *R = nullptr,
4108  const UsingDecl *UD = nullptr);
4109 
4111  SourceLocation UsingLoc,
4112  bool HasTypenameKeyword,
4113  SourceLocation TypenameLoc, CXXScopeSpec &SS,
4114  DeclarationNameInfo NameInfo,
4115  SourceLocation EllipsisLoc,
4116  const ParsedAttributesView &AttrList,
4117  bool IsInstantiation, bool IsUsingIfExists);
4119  SourceLocation UsingLoc,
4120  SourceLocation EnumLoc,
4121  SourceLocation NameLoc,
4123  NamedDecl *BuildUsingPackDecl(NamedDecl *InstantiatedFrom,
4124  ArrayRef<NamedDecl *> Expansions);
4125 
4127 
4128  /// Given a derived-class using shadow declaration for a constructor and the
4129  /// correspnding base class constructor, find or create the implicit
4130  /// synthesized derived class constructor to use for this initialization.
4133  ConstructorUsingShadowDecl *DerivedShadow);
4134 
4136  SourceLocation UsingLoc,
4137  SourceLocation TypenameLoc, CXXScopeSpec &SS,
4138  UnqualifiedId &Name, SourceLocation EllipsisLoc,
4139  const ParsedAttributesView &AttrList);
4141  SourceLocation UsingLoc,
4142  SourceLocation EnumLoc,
4143  SourceLocation IdentLoc, IdentifierInfo &II,
4144  CXXScopeSpec *SS = nullptr);
4146  MultiTemplateParamsArg TemplateParams,
4147  SourceLocation UsingLoc, UnqualifiedId &Name,
4148  const ParsedAttributesView &AttrList,
4149  TypeResult Type, Decl *DeclFromDeclSpec);
4150 
4151  /// BuildCXXConstructExpr - Creates a complete call to a constructor,
4152  /// including handling of its default argument expressions.
4153  ///
4154  /// \param ConstructKind - a CXXConstructExpr::ConstructionKind
4156  SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl,
4157  CXXConstructorDecl *Constructor, MultiExprArg Exprs,
4158  bool HadMultipleCandidates, bool IsListInitialization,
4159  bool IsStdInitListInitialization, bool RequiresZeroInit,
4160  CXXConstructionKind ConstructKind, SourceRange ParenRange);
4161 
4162  /// Build a CXXConstructExpr whose constructor has already been resolved if
4163  /// it denotes an inherited constructor.
4165  SourceLocation ConstructLoc, QualType DeclInitType,
4166  CXXConstructorDecl *Constructor, bool Elidable, MultiExprArg Exprs,
4167  bool HadMultipleCandidates, bool IsListInitialization,
4168  bool IsStdInitListInitialization, bool RequiresZeroInit,
4169  CXXConstructionKind ConstructKind, SourceRange ParenRange);
4170 
4171  // FIXME: Can we remove this and have the above BuildCXXConstructExpr check if
4172  // the constructor can be elidable?
4174  SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl,
4175  CXXConstructorDecl *Constructor, bool Elidable, MultiExprArg Exprs,
4176  bool HadMultipleCandidates, bool IsListInitialization,
4177  bool IsStdInitListInitialization, bool RequiresZeroInit,
4178  CXXConstructionKind ConstructKind, SourceRange ParenRange);
4179 
4181  SourceLocation InitLoc);
4182 
4183  /// FinalizeVarWithDestructor - Prepare for calling destructor on the
4184  /// constructed variable.
4185  void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType);
4186 
4187  /// Helper class that collects exception specifications for
4188  /// implicitly-declared special member functions.
4190  // Pointer to allow copying
4191  Sema *Self;
4192  // We order exception specifications thus:
4193  // noexcept is the most restrictive, but is only used in C++11.
4194  // throw() comes next.
4195  // Then a throw(collected exceptions)
4196  // Finally no specification, which is expressed as noexcept(false).
4197  // throw(...) is used instead if any called function uses it.
4198  ExceptionSpecificationType ComputedEST;
4199  llvm::SmallPtrSet<CanQualType, 4> ExceptionsSeen;
4200  SmallVector<QualType, 4> Exceptions;
4201 
4202  void ClearExceptions() {
4203  ExceptionsSeen.clear();
4204  Exceptions.clear();
4205  }
4206 
4207  public:
4209  : Self(&Self), ComputedEST(EST_BasicNoexcept) {
4210  if (!Self.getLangOpts().CPlusPlus11)
4211  ComputedEST = EST_DynamicNone;
4212  }
4213 
4214  /// Get the computed exception specification type.
4216  assert(!isComputedNoexcept(ComputedEST) &&
4217  "noexcept(expr) should not be a possible result");
4218  return ComputedEST;
4219  }
4220 
4221  /// The number of exceptions in the exception specification.
4222  unsigned size() const { return Exceptions.size(); }
4223 
4224  /// The set of exceptions in the exception specification.
4225  const QualType *data() const { return Exceptions.data(); }
4226 
4227  /// Integrate another called method into the collected data.
4228  void CalledDecl(SourceLocation CallLoc, const CXXMethodDecl *Method);
4229 
4230  /// Integrate an invoked expression into the collected data.
4231  void CalledExpr(Expr *E) { CalledStmt(E); }
4232 
4233  /// Integrate an invoked statement into the collected data.
4234  void CalledStmt(Stmt *S);
4235 
4236  /// Overwrite an EPI's exception specification with this
4237  /// computed exception specification.
4240  ESI.Type = getExceptionSpecType();
4241  if (ESI.Type == EST_Dynamic) {
4242  ESI.Exceptions = Exceptions;
4243  } else if (ESI.Type == EST_None) {
4244  /// C++11 [except.spec]p14:
4245  /// The exception-specification is noexcept(false) if the set of
4246  /// potential exceptions of the special member function contains "any"
4247  ESI.Type = EST_NoexceptFalse;
4248  ESI.NoexceptExpr =
4249  Self->ActOnCXXBoolLiteral(SourceLocation(), tok::kw_false).get();
4250  }
4251  return ESI;
4252  }
4253  };
4254 
4255  /// Evaluate the implicit exception specification for a defaulted
4256  /// special member function.
4258 
4259  /// Check the given exception-specification and update the
4260  /// exception specification information with the results.
4261  void checkExceptionSpecification(bool IsTopLevel,
4263  ArrayRef<ParsedType> DynamicExceptions,
4264  ArrayRef<SourceRange> DynamicExceptionRanges,
4265  Expr *NoexceptExpr,
4266  SmallVectorImpl<QualType> &Exceptions,
4268 
4269  /// Add an exception-specification to the given member function
4270  /// (or member function template). The exception-specification was parsed
4271  /// after the method itself was declared.
4273  Decl *Method, ExceptionSpecificationType EST,
4274  SourceRange SpecificationRange, ArrayRef<ParsedType> DynamicExceptions,
4275  ArrayRef<SourceRange> DynamicExceptionRanges, Expr *NoexceptExpr);
4276 
4277  class InheritedConstructorInfo;
4278 
4279  /// Determine if a special member function should have a deleted
4280  /// definition when it is defaulted.
4282  InheritedConstructorInfo *ICI = nullptr,
4283  bool Diagnose = false);
4284 
4285  /// Produce notes explaining why a defaulted function was defined as deleted.
4287 
4288  /// Declare the implicit default constructor for the given class.
4289  ///
4290  /// \param ClassDecl The class declaration into which the implicit
4291  /// default constructor will be added.
4292  ///
4293  /// \returns The implicitly-declared default constructor.
4296 
4297  /// DefineImplicitDefaultConstructor - Checks for feasibility of
4298  /// defining this constructor as the default constructor.
4299  void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
4300  CXXConstructorDecl *Constructor);
4301 
4302  /// Declare the implicit destructor for the given class.
4303  ///
4304  /// \param ClassDecl The class declaration into which the implicit
4305  /// destructor will be added.
4306  ///
4307  /// \returns The implicitly-declared destructor.
4309 
4310  /// DefineImplicitDestructor - Checks for feasibility of
4311  /// defining this destructor as the default destructor.
4312  void DefineImplicitDestructor(SourceLocation CurrentLocation,
4313  CXXDestructorDecl *Destructor);
4314 
4315  /// Build an exception spec for destructors that don't have one.
4316  ///
4317  /// C++11 says that user-defined destructors with no exception spec get one
4318  /// that looks as if the destructor was implicitly declared.
4320 
4321  /// Define the specified inheriting constructor.
4323  CXXConstructorDecl *Constructor);
4324 
4325  /// Declare the implicit copy constructor for the given class.
4326  ///
4327  /// \param ClassDecl The class declaration into which the implicit
4328  /// copy constructor will be added.
4329  ///
4330  /// \returns The implicitly-declared copy constructor.
4332 
4333  /// DefineImplicitCopyConstructor - Checks for feasibility of
4334  /// defining this constructor as the copy constructor.
4335  void DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
4336  CXXConstructorDecl *Constructor);
4337 
4338  /// Declare the implicit move constructor for the given class.
4339  ///
4340  /// \param ClassDecl The Class declaration into which the implicit
4341  /// move constructor will be added.
4342  ///
4343  /// \returns The implicitly-declared move constructor, or NULL if it wasn't
4344  /// declared.
4346 
4347  /// DefineImplicitMoveConstructor - Checks for feasibility of
4348  /// defining this constructor as the move constructor.
4349  void DefineImplicitMoveConstructor(SourceLocation CurrentLocation,
4350  CXXConstructorDecl *Constructor);
4351 
4352  /// Declare the implicit copy assignment operator for the given class.
4353  ///
4354  /// \param ClassDecl The class declaration into which the implicit
4355  /// copy assignment operator will be added.
4356  ///
4357  /// \returns The implicitly-declared copy assignment operator.
4359 
4360  /// Defines an implicitly-declared copy assignment operator.
4361  void DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
4362  CXXMethodDecl *MethodDecl);
4363 
4364  /// Declare the implicit move assignment operator for the given class.
4365  ///
4366  /// \param ClassDecl The Class declaration into which the implicit
4367  /// move assignment operator will be added.
4368  ///
4369  /// \returns The implicitly-declared move assignment operator, or NULL if it
4370  /// wasn't declared.
4372 
4373  /// Defines an implicitly-declared move assignment operator.
4374  void DefineImplicitMoveAssignment(SourceLocation CurrentLocation,
4375  CXXMethodDecl *MethodDecl);
4376 
4377  /// Check a completed declaration of an implicit special member.
4379 
4380  /// Determine whether the given function is an implicitly-deleted
4381  /// special member function.
4383 
4384  /// Check whether 'this' shows up in the type of a static member
4385  /// function after the (naturally empty) cv-qualifier-seq would be.
4386  ///
4387  /// \returns true if an error occurred.
4389 
4390  /// Whether this' shows up in the exception specification of a static
4391  /// member function.
4393 
4394  /// Check whether 'this' shows up in the attributes of the given
4395  /// static member function.
4396  ///
4397  /// \returns true if an error occurred.
4399 
4401  FunctionDecl *FD, const sema::FunctionScopeInfo *FSI);
4402 
4404 
4405  bool CompleteConstructorCall(CXXConstructorDecl *Constructor,
4406  QualType DeclInitType, MultiExprArg ArgsPtr,
4407  SourceLocation Loc,
4408  SmallVectorImpl<Expr *> &ConvertedArgs,
4409  bool AllowExplicit = false,
4410  bool IsListInitialization = false);
4411 
4412  /// ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an
4413  /// initializer for the declaration 'Dcl'.
4414  /// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
4415  /// static data member of class X, names should be looked up in the scope of
4416  /// class X.
4417  void ActOnCXXEnterDeclInitializer(Scope *S, Decl *Dcl);
4418 
4419  /// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
4420  /// initializer for the declaration 'Dcl'.
4421  void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl);
4422 
4423  /// Define the "body" of the conversion from a lambda object to a
4424  /// function pointer.
4425  ///
4426  /// This routine doesn't actually define a sensible body; rather, it fills
4427  /// in the initialization expression needed to copy the lambda object into
4428  /// the block, and IR generation actually generates the real body of the
4429  /// block pointer conversion.
4430  void
4432  CXXConversionDecl *Conv);
4433 
4434  /// Define the "body" of the conversion from a lambda object to a
4435  /// block pointer.
4436  ///
4437  /// This routine doesn't actually define a sensible body; rather, it fills
4438  /// in the initialization expression needed to copy the lambda object into
4439  /// the block, and IR generation actually generates the real body of the
4440  /// block pointer conversion.
4442  CXXConversionDecl *Conv);
4443 
4445  Expr *LangStr, SourceLocation LBraceLoc);
4446  Decl *ActOnFinishLinkageSpecification(Scope *S, Decl *LinkageSpec,
4447  SourceLocation RBraceLoc);
4448 
4449  //===--------------------------------------------------------------------===//
4450  // C++ Classes
4451  //
4453  bool isCurrentClassName(const IdentifierInfo &II, Scope *S,
4454  const CXXScopeSpec *SS = nullptr);
4455  bool isCurrentClassNameTypo(IdentifierInfo *&II, const CXXScopeSpec *SS);
4456 
4458  SourceLocation ColonLoc,
4459  const ParsedAttributesView &Attrs);
4460 
4461  NamedDecl *
4463  MultiTemplateParamsArg TemplateParameterLists,
4464  Expr *BitfieldWidth, const VirtSpecifiers &VS,
4465  InClassInitStyle InitStyle);
4466 
4469  SourceLocation EqualLoc,
4470  Expr *Init);
4471 
4473  ActOnMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS,
4474  IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy,
4475  const DeclSpec &DS, SourceLocation IdLoc,
4476  SourceLocation LParenLoc, ArrayRef<Expr *> Args,
4477  SourceLocation RParenLoc, SourceLocation EllipsisLoc);
4478 
4479  MemInitResult ActOnMemInitializer(Decl *ConstructorD, Scope *S,
4480  CXXScopeSpec &SS,
4481  IdentifierInfo *MemberOrBase,
4482  ParsedType TemplateTypeTy,
4483  const DeclSpec &DS, SourceLocation IdLoc,
4484  Expr *InitList, SourceLocation EllipsisLoc);
4485 
4486  MemInitResult BuildMemInitializer(Decl *ConstructorD, Scope *S,
4487  CXXScopeSpec &SS,
4488  IdentifierInfo *MemberOrBase,
4489  ParsedType TemplateTypeTy,
4490  const DeclSpec &DS, SourceLocation IdLoc,
4491  Expr *Init, SourceLocation EllipsisLoc);
4492 
4494  SourceLocation IdLoc);
4495 
4497  TypeSourceInfo *BaseTInfo, Expr *Init,
4498  CXXRecordDecl *ClassDecl,
4499  SourceLocation EllipsisLoc);
4500 
4502  CXXRecordDecl *ClassDecl);
4503 
4504  bool SetDelegatingInitializer(CXXConstructorDecl *Constructor,
4505  CXXCtorInitializer *Initializer);
4506 
4507  bool SetCtorInitializers(
4508  CXXConstructorDecl *Constructor, bool AnyErrors,
4509  ArrayRef<CXXCtorInitializer *> Initializers = std::nullopt);
4510 
4511  void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation);
4512 
4513  /// MarkBaseAndMemberDestructorsReferenced - Given a record decl,
4514  /// mark all the non-trivial destructors of its members and bases as
4515  /// referenced.
4518 
4519  /// Mark destructors of virtual bases of this class referenced. In the Itanium
4520  /// C++ ABI, this is done when emitting a destructor for any non-abstract
4521  /// class. In the Microsoft C++ ABI, this is done any time a class's
4522  /// destructor is referenced.
4524  SourceLocation Location, CXXRecordDecl *ClassDecl,
4525  llvm::SmallPtrSetImpl<const RecordType *> *DirectVirtualBases = nullptr);
4526 
4527  /// Do semantic checks to allow the complete destructor variant to be emitted
4528  /// when the destructor is defined in another translation unit. In the Itanium
4529  /// C++ ABI, destructor variants are emitted together. In the MS C++ ABI, they
4530  /// can be emitted in separate TUs. To emit the complete variant, run a subset
4531  /// of the checks performed when emitting a regular destructor.
4532  void CheckCompleteDestructorVariant(SourceLocation CurrentLocation,
4533  CXXDestructorDecl *Dtor);
4534 
4535  /// The list of classes whose vtables have been used within
4536  /// this translation unit, and the source locations at which the
4537  /// first use occurred.
4538  typedef std::pair<CXXRecordDecl *, SourceLocation> VTableUse;
4539 
4540  /// The list of vtables that are required but have not yet been
4541  /// materialized.
4543 
4544  /// The set of classes whose vtables have been used within
4545  /// this translation unit, and a bit that will be true if the vtable is
4546  /// required to be emitted (otherwise, it should be emitted only if needed
4547  /// by code generation).
4548  llvm::DenseMap<CXXRecordDecl *, bool> VTablesUsed;
4549 
4550  /// Load any externally-stored vtable uses.
4551  void LoadExternalVTableUses();
4552 
4553  /// Note that the vtable for the given class was used at the
4554  /// given location.
4555  void MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class,
4556  bool DefinitionRequired = false);
4557 
4558  /// Mark the exception specifications of all virtual member functions
4559  /// in the given class as needed.
4561  const CXXRecordDecl *RD);
4562 
4563  /// MarkVirtualMembersReferenced - Will mark all members of the given
4564  /// CXXRecordDecl referenced.
4566  bool ConstexprOnly = false);
4567 
4568  /// Define all of the vtables that have been used in this
4569  /// translation unit and reference any virtual members used by those
4570  /// vtables.
4571  ///
4572  /// \returns true if any work was done, false otherwise.
4573  bool DefineUsedVTables();
4574 
4576 
4577  void ActOnMemInitializers(Decl *ConstructorDecl, SourceLocation ColonLoc,
4579  bool AnyErrors);
4580 
4581  /// Check class-level dllimport/dllexport attribute. The caller must
4582  /// ensure that referenceDLLExportedClassMethods is called some point later
4583  /// when all outer classes of Class are complete.
4586 
4588 
4590  CXXRecordDecl *Class, Attr *ClassAttr,
4591  ClassTemplateSpecializationDecl *BaseTemplateSpec,
4592  SourceLocation BaseLoc);
4593 
4595 
4596  /// Check that the C++ class annoated with "trivial_abi" satisfies all the
4597  /// conditions that are needed for the attribute to have an effect.
4599 
4601  Decl *TagDecl, SourceLocation LBrac,
4602  SourceLocation RBrac,
4603  const ParsedAttributesView &AttrList);
4606 
4608  unsigned ActOnReenterTemplateScope(Decl *Template,
4609  llvm::function_ref<Scope *()> EnterScope);
4612  void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param);
4616 
4617  bool EvaluateStaticAssertMessageAsString(Expr *Message, std::string &Result,
4618  ASTContext &Ctx,
4619  bool ErrorOnInvalidMessage);
4621  Expr *AssertExpr, Expr *AssertMessageExpr,
4622  SourceLocation RParenLoc);
4624  Expr *AssertExpr, Expr *AssertMessageExpr,
4625  SourceLocation RParenLoc, bool Failed);
4626  void DiagnoseStaticAssertDetails(const Expr *E);
4627 
4628  Decl *ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
4629  MultiTemplateParamsArg TemplateParams);
4631  MultiTemplateParamsArg TemplateParams);
4632 
4634  StorageClass &SC);
4635  void CheckConstructor(CXXConstructorDecl *Constructor);
4637  StorageClass &SC);
4638  bool CheckDestructor(CXXDestructorDecl *Destructor);
4642  StorageClass &SC);
4643 
4645 
4648  SourceLocation DefaultLoc);
4650 
4651  /// Kinds of defaulted comparison operator functions.
4652  enum class DefaultedComparisonKind : unsigned char {
4653  /// This is not a defaultable comparison operator.
4654  None,
4655  /// This is an operator== that should be implemented as a series of
4656  /// subobject comparisons.
4657  Equal,
4658  /// This is an operator<=> that should be implemented as a series of
4659  /// subobject comparisons.
4660  ThreeWay,
4661  /// This is an operator!= that should be implemented as a rewrite in terms
4662  /// of a == comparison.
4663  NotEqual,
4664  /// This is an <, <=, >, or >= that should be implemented as a rewrite in
4665  /// terms of a <=> comparison.
4666  Relational,
4667  };
4668 
4675 
4677  QualType R, bool IsLambda,
4678  DeclContext *DC = nullptr);
4680  DeclarationName Name, QualType R);
4682 
4683  //===--------------------------------------------------------------------===//
4684  // C++ Derived Classes
4685  //
4686 
4687  /// ActOnBaseSpecifier - Parsed a base specifier
4689  SourceRange SpecifierRange, bool Virtual,
4690  AccessSpecifier Access,
4691  TypeSourceInfo *TInfo,
4692  SourceLocation EllipsisLoc);
4693 
4694  BaseResult ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange,
4695  const ParsedAttributesView &Attrs, bool Virtual,
4696  AccessSpecifier Access, ParsedType basetype,
4697  SourceLocation BaseLoc,
4698  SourceLocation EllipsisLoc);
4699 
4700  bool AttachBaseSpecifiers(CXXRecordDecl *Class,
4702  void ActOnBaseSpecifiers(Decl *ClassDecl,
4704 
4705  bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base);
4706  bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base,
4707  CXXBasePaths &Paths);
4708 
4709  // FIXME: I don't like this name.
4710  void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath);
4711 
4713  SourceLocation Loc, SourceRange Range,
4714  CXXCastPath *BasePath = nullptr,
4715  bool IgnoreAccess = false);
4717  unsigned InaccessibleBaseID,
4718  unsigned AmbiguousBaseConvID,
4719  SourceLocation Loc, SourceRange Range,
4720  DeclarationName Name, CXXCastPath *BasePath,
4721  bool IgnoreAccess = false);
4722 
4723  std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths);
4724 
4726  const CXXMethodDecl *Old);
4727 
4728  /// CheckOverridingFunctionReturnType - Checks whether the return types are
4729  /// covariant, according to C++ [class.virtual]p5.
4731  const CXXMethodDecl *Old);
4732 
4733  // Check that the overriding method has no explicit object parameter.
4735  const CXXMethodDecl *Old);
4736 
4737  bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange);
4738 
4739  /// CheckOverrideControl - Check C++11 override control semantics.
4741 
4742  /// DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was
4743  /// not used in the declaration of an overriding method.
4744  void DiagnoseAbsenceOfOverrideControl(NamedDecl *D, bool Inconsistent);
4745 
4746  /// CheckForFunctionMarkedFinal - Checks whether a virtual member function
4747  /// overrides a virtual member function marked 'final', according to
4748  /// C++11 [class.virtual]p4.
4750  const CXXMethodDecl *Old);
4751 
4761  };
4762 
4763  struct TypeDiagnoser;
4764 
4767  TypeDiagnoser &Diagnoser);
4768  template <typename... Ts>
4769  bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID,
4770  const Ts &...Args) {
4771  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
4772  return RequireNonAbstractType(Loc, T, Diagnoser);
4773  }
4774 
4775  void DiagnoseAbstractType(const CXXRecordDecl *RD);
4776 
4777  //===--------------------------------------------------------------------===//
4778  // C++ Overloaded Operators [C++ 13.5]
4779  //
4780 
4782 
4784 
4785  /// ActOnExplicitBoolSpecifier - Build an ExplicitSpecifier from an expression
4786  /// found in an explicit(bool) specifier.
4788 
4789  /// tryResolveExplicitSpecifier - Attempt to resolve the explict specifier.
4790  /// Returns true if the explicit specifier is now resolved.
4791  bool tryResolveExplicitSpecifier(ExplicitSpecifier &ExplicitSpec);
4792 
4794 
4795  // Emitting members of dllexported classes is delayed until the class
4796  // (including field initializers) is fully parsed.
4799 
4800  void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old);
4801  bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old, Scope *S);
4802 
4803  /// Helpers for dealing with blocks and functions.
4806 
4809  }
4810 
4812  SourceLocation StartLoc,
4813  SourceLocation IdLoc,
4814  const IdentifierInfo *Id);
4815 
4817 
4819 
4821  unsigned TagSpec, SourceLocation TagLoc,
4822  CXXScopeSpec &SS, IdentifierInfo *Name,
4823  SourceLocation NameLoc,
4824  const ParsedAttributesView &Attr,
4825  MultiTemplateParamsArg TempParamLists);
4826 
4828  SourceLocation DeclStart, Declarator &D,
4829  Expr *BitfieldWidth,
4830  InClassInitStyle InitStyle,
4831  AccessSpecifier AS,
4832  const ParsedAttr &MSPropertyAttr);
4833 
4835  CXXSpecialMemberKind CSM);
4836 
4838  /// The triviality of a method unaffected by "trivial_abi".
4840 
4841  /// The triviality of a method affected by "trivial_abi".
4843  };
4844 
4847  bool Diagnose = false);
4848 
4849  /// For a defaulted function, the kind of defaulted function that it is.
4851  LLVM_PREFERRED_TYPE(CXXSpecialMemberKind)
4852  unsigned SpecialMember : 8;
4853  unsigned Comparison : 8;
4854 
4855  public:
4857  : SpecialMember(llvm::to_underlying(CXXSpecialMemberKind::Invalid)),
4858  Comparison(llvm::to_underlying(DefaultedComparisonKind::None)) {}
4860  : SpecialMember(llvm::to_underlying(CSM)),
4861  Comparison(llvm::to_underlying(DefaultedComparisonKind::None)) {}
4863  : SpecialMember(llvm::to_underlying(CXXSpecialMemberKind::Invalid)),
4864  Comparison(llvm::to_underlying(Comp)) {}
4865 
4866  bool isSpecialMember() const {
4867  return static_cast<CXXSpecialMemberKind>(SpecialMember) !=
4869  }
4870  bool isComparison() const {
4871  return static_cast<DefaultedComparisonKind>(Comparison) !=
4873  }
4874 
4875  explicit operator bool() const {
4876  return isSpecialMember() || isComparison();
4877  }
4878 
4880  return static_cast<CXXSpecialMemberKind>(SpecialMember);
4881  }
4883  return static_cast<DefaultedComparisonKind>(Comparison);
4884  }
4885 
4886  /// Get the index of this function kind for use in diagnostics.
4887  unsigned getDiagnosticIndex() const {
4888  static_assert(llvm::to_underlying(CXXSpecialMemberKind::Invalid) >
4889  llvm::to_underlying(CXXSpecialMemberKind::Destructor),
4890  "invalid should have highest index");
4891  static_assert((unsigned)DefaultedComparisonKind::None == 0,
4892  "none should be equal to zero");
4893  return SpecialMember + Comparison;
4894  }
4895  };
4896 
4897  DefaultedFunctionKind getDefaultedFunctionKind(const FunctionDecl *FD);
4898 
4899  /// Handle a C++11 empty-declaration and attribute-declaration.
4901  SourceLocation SemiLoc);
4902 
4903  enum class CheckConstexprKind {
4904  /// Diagnose issues that are non-constant or that are extensions.
4905  Diagnose,
4906  /// Identify whether this function satisfies the formal rules for constexpr
4907  /// functions in the current lanugage mode (with no extensions).
4908  CheckValid
4909  };
4910 
4913 
4915  void
4917  SmallVectorImpl<CXXMethodDecl *> &OverloadedMethods);
4918  void
4920  SmallVectorImpl<CXXMethodDecl *> &OverloadedMethods);
4921  void ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc,
4922  Expr *defarg);
4924  SourceLocation ArgLoc);
4925  void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc,
4926  Expr *DefaultArg);
4928  SourceLocation EqualLoc);
4929  void SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg,
4930  SourceLocation EqualLoc);
4931 
4932  void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc);
4933  void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc,
4934  StringLiteral *Message = nullptr);
4935  void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc);
4936 
4937  void SetFunctionBodyKind(Decl *D, SourceLocation Loc, FnBodyKind BodyKind,
4938  StringLiteral *DeletedMessage = nullptr);
4941  ExprResult ActOnRequiresClause(ExprResult ConstraintExpr);
4942 
4943  NamedDecl *
4945  MultiTemplateParamsArg TemplateParamLists);
4948  RecordDecl *ClassDecl,
4949  const IdentifierInfo *Name);
4950 
4952 
4953  /// Stack containing information needed when in C++2a an 'auto' is encountered
4954  /// in a function declaration parameter type specifier in order to invent a
4955  /// corresponding template parameter in the enclosing abbreviated function
4956  /// template. This information is also present in LambdaScopeInfo, stored in
4957  /// the FunctionScopes stack.
4959 
4960  /// FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
4961  std::unique_ptr<CXXFieldCollector> FieldCollector;
4962 
4964  /// Set containing all declared private fields that are not used.
4966 
4968 
4969  /// PureVirtualClassDiagSet - a set of class declarations which we have
4970  /// emitted a list of pure virtual functions. Used to prevent emitting the
4971  /// same list more than once.
4972  std::unique_ptr<RecordDeclSetTy> PureVirtualClassDiagSet;
4973 
4977 
4978  /// All the delegating constructors seen so far in the file, used for
4979  /// cycle detection at the end of the TU.
4981 
4982  /// The C++ "std" namespace, where the standard library resides.
4984 
4985  /// The C++ "std::initializer_list" template, which is defined in
4986  /// <initializer_list>.
4988 
4989  // Contains the locations of the beginning of unparsed default
4990  // argument locations.
4991  llvm::DenseMap<ParmVarDecl *, SourceLocation> UnparsedDefaultArgLocs;
4992 
4993  /// UndefinedInternals - all the used, undefined objects which require a
4994  /// definition in this translation unit.
4995  llvm::MapVector<NamedDecl *, SourceLocation> UndefinedButUsed;
4996 
4997  typedef llvm::PointerIntPair<CXXRecordDecl *, 3, CXXSpecialMemberKind>
4999 
5000  /// The C++ special members which we are currently in the process of
5001  /// declaring. If this process recursively triggers the declaration of the
5002  /// same special member, we should act as if it is not yet declared.
5004 
5006 
5007  void ActOnDefaultCtorInitializers(Decl *CDtorDecl);
5008 
5011  ParsingClassDepth++;
5013  }
5015  ParsingClassDepth--;
5017  }
5018 
5019 private:
5020  void setupImplicitSpecialMemberType(CXXMethodDecl *SpecialMem,
5021  QualType ResultTy,
5022  ArrayRef<QualType> Args);
5023 
5024  // A cache representing if we've fully checked the various comparison category
5025  // types stored in ASTContext. The bit-index corresponds to the integer value
5026  // of a ComparisonCategoryType enumerator.
5027  llvm::SmallBitVector FullyCheckedComparisonCategories;
5028 
5029  ValueDecl *tryLookupCtorInitMemberDecl(CXXRecordDecl *ClassDecl,
5030  CXXScopeSpec &SS,
5031  ParsedType TemplateTypeTy,
5032  IdentifierInfo *MemberOrBase);
5033 
5034  /// Check if there is a field shadowing.
5035  void CheckShadowInheritedFields(const SourceLocation &Loc,
5036  DeclarationName FieldName,
5037  const CXXRecordDecl *RD,
5038  bool DeclIsField = true);
5039 
5040  ///@}
5041 
5042  //
5043  //
5044  // -------------------------------------------------------------------------
5045  //
5046  //
5047 
5048  /// \name C++ Exception Specifications
5049  /// Implementations are in SemaExceptionSpec.cpp
5050  ///@{
5051 
5052 public:
5053  /// All the overriding functions seen during a class definition
5054  /// that had their exception spec checks delayed, plus the overridden
5055  /// function.
5058 
5059  /// All the function redeclarations seen during a class definition that had
5060  /// their exception spec checks delayed, plus the prior declaration they
5061  /// should be checked against. Except during error recovery, the new decl
5062  /// should always be a friend declaration, as that's the only valid way to
5063  /// redeclare a special member before its class is complete.
5066 
5067  /// Determine if we're in a case where we need to (incorrectly) eagerly
5068  /// parse an exception specification to work around a libstdc++ bug.
5070 
5071  /// Check the given noexcept-specifier, convert its expression, and compute
5072  /// the appropriate ExceptionSpecificationType.
5073  ExprResult ActOnNoexceptSpec(Expr *NoexceptExpr,
5075 
5076  CanThrowResult canThrow(const Stmt *E);
5077  /// Determine whether the callee of a particular function call can throw.
5078  /// E, D and Loc are all optional.
5079  static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, const Decl *D,
5080  SourceLocation Loc = SourceLocation());
5082  const FunctionProtoType *FPT);
5089  SourceLocation OldLoc,
5090  const FunctionProtoType *New,
5091  SourceLocation NewLoc);
5093  const PartialDiagnostic &NoteID,
5094  const FunctionProtoType *Old,
5095  SourceLocation OldLoc,
5096  const FunctionProtoType *New,
5097  SourceLocation NewLoc);
5098  bool handlerCanCatch(QualType HandlerType, QualType ExceptionType);
5100  const PartialDiagnostic &DiagID, const PartialDiagnostic &NestedDiagID,
5101  const PartialDiagnostic &NoteID, const PartialDiagnostic &NoThrowDiagID,
5102  const FunctionProtoType *Superset, bool SkipSupersetFirstParameter,
5103  SourceLocation SuperLoc, const FunctionProtoType *Subset,
5104  bool SkipSubsetFirstParameter, SourceLocation SubLoc);
5106  const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID,
5107  const FunctionProtoType *Target, bool SkipTargetFirstParameter,
5108  SourceLocation TargetLoc, const FunctionProtoType *Source,
5109  bool SkipSourceFirstParameter, SourceLocation SourceLoc);
5110 
5111  bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType);
5112 
5113  /// CheckOverridingFunctionExceptionSpec - Checks whether the exception
5114  /// spec is a subset of base spec.
5116  const CXXMethodDecl *Old);
5117 
5118  ///@}
5119 
5120  //
5121  //
5122  // -------------------------------------------------------------------------
5123  //
5124  //
5125 
5126  /// \name Expressions
5127  /// Implementations are in SemaExpr.cpp
5128  ///@{
5129 
5130 public:
5131  /// Describes how the expressions currently being parsed are
5132  /// evaluated at run-time, if at all.
5134  /// The current expression and its subexpressions occur within an
5135  /// unevaluated operand (C++11 [expr]p7), such as the subexpression of
5136  /// \c sizeof, where the type of the expression may be significant but
5137  /// no code will be generated to evaluate the value of the expression at
5138  /// run time.
5139  Unevaluated,
5140 
5141  /// The current expression occurs within a braced-init-list within
5142  /// an unevaluated operand. This is mostly like a regular unevaluated
5143  /// context, except that we still instantiate constexpr functions that are
5144  /// referenced here so that we can perform narrowing checks correctly.
5145  UnevaluatedList,
5146 
5147  /// The current expression occurs within a discarded statement.
5148  /// This behaves largely similarly to an unevaluated operand in preventing
5149  /// definitions from being required, but not in other ways.
5150  DiscardedStatement,
5151 
5152  /// The current expression occurs within an unevaluated
5153  /// operand that unconditionally permits abstract references to
5154  /// fields, such as a SIZE operator in MS-style inline assembly.
5155  UnevaluatedAbstract,
5156 
5157  /// The current context is "potentially evaluated" in C++11 terms,
5158  /// but the expression is evaluated at compile-time (like the values of
5159  /// cases in a switch statement).
5160  ConstantEvaluated,
5161 
5162  /// In addition of being constant evaluated, the current expression
5163  /// occurs in an immediate function context - either a consteval function
5164  /// or a consteval if statement.
5165  ImmediateFunctionContext,
5166 
5167  /// The current expression is potentially evaluated at run time,
5168  /// which means that code may be generated to evaluate the value of the
5169  /// expression at run time.
5170  PotentiallyEvaluated,
5171 
5172  /// The current expression is potentially evaluated, but any
5173  /// declarations referenced inside that expression are only used if
5174  /// in fact the current expression is used.
5175  ///
5176  /// This value is used when parsing default function arguments, for which
5177  /// we would like to provide diagnostics (e.g., passing non-POD arguments
5178  /// through varargs) but do not want to mark declarations as "referenced"
5179  /// until the default argument is used.
5180  PotentiallyEvaluatedIfUsed
5181  };
5182 
5183  /// Store a set of either DeclRefExprs or MemberExprs that contain a reference
5184  /// to a variable (constant) that may or may not be odr-used in this Expr, and
5185  /// we won't know until all lvalue-to-rvalue and discarded value conversions
5186  /// have been applied to all subexpressions of the enclosing full expression.
5187  /// This is cleared at the end of each full expression.
5190 
5191  using ImmediateInvocationCandidate = llvm::PointerIntPair<ConstantExpr *, 1>;
5192 
5193  /// Data structure used to record current or nested
5194  /// expression evaluation contexts.
5196  /// The expression evaluation context.
5198 
5199  /// Whether the enclosing context needed a cleanup.
5201 
5202  /// The number of active cleanup objects when we entered
5203  /// this expression evaluation context.
5205 
5206  /// The number of typos encountered during this expression evaluation
5207  /// context (i.e. the number of TypoExprs created).
5208  unsigned NumTypos;
5209 
5211 
5212  /// The lambdas that are present within this context, if it
5213  /// is indeed an unevaluated context.
5215 
5216  /// The declaration that provides context for lambda expressions
5217  /// and block literals if the normal declaration context does not
5218  /// suffice, e.g., in a default function argument.
5220 
5221  /// If we are processing a decltype type, a set of call expressions
5222  /// for which we have deferred checking the completeness of the return type.
5224 
5225  /// If we are processing a decltype type, a set of temporary binding
5226  /// expressions for which we have deferred checking the destructor.
5228 
5230 
5231  /// Expressions appearing as the LHS of a volatile assignment in this
5232  /// context. We produce a warning for these when popping the context if
5233  /// they are not discarded-value expressions nor unevaluated operands.
5235 
5236  /// Set of candidates for starting an immediate invocation.
5239 
5240  /// Set of DeclRefExprs referencing a consteval function when used in a
5241  /// context not already known to be immediately invoked.
5243 
5244  /// P2718R0 - Lifetime extension in range-based for loops.
5245  /// MaterializeTemporaryExprs in for-range-init expressions which need to
5246  /// extend lifetime. Add MaterializeTemporaryExpr* if the value of
5247  /// InLifetimeExtendingContext is true.
5249 
5250  /// \brief Describes whether we are in an expression constext which we have
5251  /// to handle differently.
5256  EK_Other
5257  } ExprContext;
5258 
5259  // A context can be nested in both a discarded statement context and
5260  // an immediate function context, so they need to be tracked independently.
5264 
5265  bool IsCurrentlyCheckingDefaultArgumentOrInitializer = false;
5266 
5267  // We are in a constant context, but we also allow
5268  // non constant expressions, for example for array bounds (which may be
5269  // VLAs).
5270  bool InConditionallyConstantEvaluateContext = false;
5271 
5272  /// Whether we are currently in a context in which all temporaries must be
5273  /// lifetime-extended, even if they're not bound to a reference (for
5274  /// example, in a for-range initializer).
5275  bool InLifetimeExtendingContext = false;
5276 
5277  // When evaluating immediate functions in the initializer of a default
5278  // argument or default member initializer, this is the declaration whose
5279  // default initializer is being evaluated and the location of the call
5280  // or constructor definition.
5284  : Loc(Loc), Decl(Decl), Context(Context) {
5285  assert(Decl && Context && "invalid initialization context");
5286  }
5287 
5289  ValueDecl *Decl = nullptr;
5290  DeclContext *Context = nullptr;
5291  };
5292  std::optional<InitializationContext> DelayedDefaultInitializationContext;
5293 
5295  unsigned NumCleanupObjects,
5296  CleanupInfo ParentCleanup,
5297  Decl *ManglingContextDecl,
5298  ExpressionKind ExprContext)
5299  : Context(Context), ParentCleanup(ParentCleanup),
5300  NumCleanupObjects(NumCleanupObjects), NumTypos(0),
5301  ManglingContextDecl(ManglingContextDecl), ExprContext(ExprContext),
5302  InDiscardedStatement(false), InImmediateFunctionContext(false),
5303  InImmediateEscalatingFunctionContext(false) {}
5304 
5305  bool isUnevaluated() const {
5309  }
5310 
5311  bool isConstantEvaluated() const {
5314  }
5315 
5319  InImmediateFunctionContext) ||
5320  // C++23 [expr.const]p14:
5321  // An expression or conversion is in an immediate function
5322  // context if it is potentially evaluated and either:
5323  // * its innermost enclosing non-block scope is a function
5324  // parameter scope of an immediate function, or
5325  // * its enclosing statement is enclosed by the compound-
5326  // statement of a consteval if statement.
5328  InImmediateFunctionContext);
5329  }
5330 
5333  (Context ==
5335  InDiscardedStatement);
5336  }
5337  };
5338 
5340  assert(!ExprEvalContexts.empty() &&
5341  "Must be in an expression evaluation context");
5342  return ExprEvalContexts.back();
5343  };
5344 
5345  bool isBoundsAttrContext() const {
5346  return ExprEvalContexts.back().ExprContext ==
5347  ExpressionEvaluationContextRecord::ExpressionKind::
5348  EK_BoundsAttrArgument;
5349  }
5350 
5351  /// Increment when we find a reference; decrement when we find an ignored
5352  /// assignment. Ultimately the value is 0 if every reference is an ignored
5353  /// assignment.
5354  llvm::DenseMap<const VarDecl *, int> RefsMinusAssignments;
5355 
5356  /// Used to control the generation of ExprWithCleanups.
5358 
5359  /// ExprCleanupObjects - This is the stack of objects requiring
5360  /// cleanup that are created by the current full expression.
5362 
5363  // AssignmentAction - This is used by all the assignment diagnostic functions
5364  // to represent what is actually causing the operation
5374  };
5375 
5376  bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid);
5377  // A version of DiagnoseUseOfDecl that should be used if overload resolution
5378  // has been used to find this declaration, which means we don't have to bother
5379  // checking the trailing requires clause.
5381  return DiagnoseUseOfDecl(
5382  D, Loc, /*UnknownObjCClass=*/nullptr, /*ObjCPropertyAccess=*/false,
5383  /*AvoidPartialAvailabilityChecks=*/false, /*ClassReceiver=*/nullptr,
5384  /*SkipTrailingRequiresClause=*/true);
5385  }
5386 
5388  const ObjCInterfaceDecl *UnknownObjCClass = nullptr,
5389  bool ObjCPropertyAccess = false,
5390  bool AvoidPartialAvailabilityChecks = false,
5391  ObjCInterfaceDecl *ClassReciever = nullptr,
5392  bool SkipTrailingRequiresClause = false);
5394 
5395  void DiagnoseSentinelCalls(const NamedDecl *D, SourceLocation Loc,
5396  ArrayRef<Expr *> Args);
5397 
5399  ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl = nullptr,
5408 
5410 
5414 
5416 
5418 
5419  // Functions for marking a declaration referenced. These functions also
5420  // contain the relevant logic for marking if a reference to a function or
5421  // variable is an odr-use (in the C++11 sense). There are separate variants
5422  // for expressions referring to a decl; these exist because odr-use marking
5423  // needs to be delayed for some constant variables when we build one of the
5424  // named expressions.
5425  //
5426  // MightBeOdrUse indicates whether the use could possibly be an odr-use, and
5427  // should usually be true. This only needs to be set to false if the lack of
5428  // odr-use cannot be determined from the current context (for instance,
5429  // because the name denotes a virtual function and was written without an
5430  // explicit nested-name-specifier).
5431  void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse);
5433  bool MightBeOdrUse = true);
5435  void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base = nullptr);
5439  unsigned CapturingScopeIndex);
5440 
5442  void CleanupVarDeclMarking();
5443 
5448  };
5449 
5450  /// Try to capture the given variable.
5451  ///
5452  /// \param Var The variable to capture.
5453  ///
5454  /// \param Loc The location at which the capture occurs.
5455  ///
5456  /// \param Kind The kind of capture, which may be implicit (for either a
5457  /// block or a lambda), or explicit by-value or by-reference (for a lambda).
5458  ///
5459  /// \param EllipsisLoc The location of the ellipsis, if one is provided in
5460  /// an explicit lambda capture.
5461  ///
5462  /// \param BuildAndDiagnose Whether we are actually supposed to add the
5463  /// captures or diagnose errors. If false, this routine merely check whether
5464  /// the capture can occur without performing the capture itself or complaining
5465  /// if the variable cannot be captured.
5466  ///
5467  /// \param CaptureType Will be set to the type of the field used to capture
5468  /// this variable in the innermost block or lambda. Only valid when the
5469  /// variable can be captured.
5470  ///
5471  /// \param DeclRefType Will be set to the type of a reference to the capture
5472  /// from within the current scope. Only valid when the variable can be
5473  /// captured.
5474  ///
5475  /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
5476  /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
5477  /// This is useful when enclosing lambdas must speculatively capture
5478  /// variables that may or may not be used in certain specializations of
5479  /// a nested generic lambda.
5480  ///
5481  /// \returns true if an error occurred (i.e., the variable cannot be
5482  /// captured) and false if the capture succeeded.
5484  TryCaptureKind Kind, SourceLocation EllipsisLoc,
5485  bool BuildAndDiagnose, QualType &CaptureType,
5486  QualType &DeclRefType,
5487  const unsigned *const FunctionScopeIndexToStopAt);
5488 
5489  /// Try to capture the given variable.
5492  SourceLocation EllipsisLoc = SourceLocation());
5493 
5494  /// Checks if the variable must be captured.
5496 
5497  /// Given a variable, determine the type that a reference to that
5498  /// variable will have in the given scope.
5500 
5501  /// Mark all of the declarations referenced within a particular AST node as
5502  /// referenced. Used when template instantiation instantiates a non-dependent
5503  /// type -- entities referenced by the type are now referenced.
5506  Expr *E, bool SkipLocalVariables = false,
5507  ArrayRef<const Expr *> StopAt = std::nullopt);
5508 
5509  /// Try to convert an expression \p E to type \p Ty. Returns the result of the
5510  /// conversion.
5512 
5513  /// Conditionally issue a diagnostic based on the statements's reachability
5514  /// analysis.
5515  ///
5516  /// \param Stmts If Stmts is non-empty, delay reporting the diagnostic until
5517  /// the function body is parsed, and then do a basic reachability analysis to
5518  /// determine if the statement is reachable. If it is unreachable, the
5519  /// diagnostic will not be emitted.
5521  const PartialDiagnostic &PD);
5522 
5523  /// Conditionally issue a diagnostic based on the current
5524  /// evaluation context.
5525  ///
5526  /// \param Statement If Statement is non-null, delay reporting the
5527  /// diagnostic until the function body is parsed, and then do a basic
5528  /// reachability analysis to determine if the statement is reachable.
5529  /// If it is unreachable, the diagnostic will not be emitted.
5530  bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement,
5531  const PartialDiagnostic &PD);
5532  /// Similar, but diagnostic is only produced if all the specified statements
5533  /// are reachable.
5535  const PartialDiagnostic &PD);
5536 
5537  // Primary Expressions.
5538  SourceRange getExprRange(Expr *E) const;
5539 
5541  SourceLocation TemplateKWLoc, UnqualifiedId &Id,
5542  bool HasTrailingLParen, bool IsAddressOfOperand,
5543  CorrectionCandidateCallback *CCC = nullptr,
5544  bool IsInlineAsmIdentifier = false,
5545  Token *KeywordReplacement = nullptr);
5546 
5548  TemplateArgumentListInfo &Buffer,
5549  DeclarationNameInfo &NameInfo,
5550  const TemplateArgumentListInfo *&TemplateArgs);
5551 
5553 
5554  bool
5557  TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
5558  ArrayRef<Expr *> Args = std::nullopt,
5559  DeclContext *LookupCtx = nullptr,
5560  TypoExpr **Out = nullptr);
5561 
5563  IdentifierInfo *II);
5565 
5567  IdentifierInfo *II,
5568  bool AllowBuiltinCreation = false);
5569 
5570  /// If \p D cannot be odr-used in the current expression evaluation context,
5571  /// return a reason explaining why. Otherwise, return NOUR_None.
5573 
5575  SourceLocation Loc,
5576  const CXXScopeSpec *SS = nullptr);
5577  DeclRefExpr *
5579  const DeclarationNameInfo &NameInfo,
5580  const CXXScopeSpec *SS = nullptr,
5581  NamedDecl *FoundD = nullptr,
5582  SourceLocation TemplateKWLoc = SourceLocation(),
5583  const TemplateArgumentListInfo *TemplateArgs = nullptr);
5584  DeclRefExpr *
5586  const DeclarationNameInfo &NameInfo,
5587  NestedNameSpecifierLoc NNS, NamedDecl *FoundD = nullptr,
5588  SourceLocation TemplateKWLoc = SourceLocation(),
5589  const TemplateArgumentListInfo *TemplateArgs = nullptr);
5590 
5591  bool UseArgumentDependentLookup(const CXXScopeSpec &SS, const LookupResult &R,
5592  bool HasTrailingLParen);
5593 
5594  ExprResult
5596  const DeclarationNameInfo &NameInfo,
5597  bool IsAddressOfOperand, const Scope *S,
5598  TypeSourceInfo **RecoveryTSI = nullptr);
5599 
5601  bool NeedsADL,
5602  bool AcceptInvalidDecl = false);
5604  const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, NamedDecl *D,
5605  NamedDecl *FoundD = nullptr,
5606  const TemplateArgumentListInfo *TemplateArgs = nullptr,
5607  bool AcceptInvalidDecl = false);
5608 
5609  // ExpandFunctionLocalPredefinedMacros - Returns a new vector of Tokens,
5610  // where Tokens representing function local predefined macros (such as
5611  // __FUNCTION__) are replaced (expanded) with string-literal Tokens.
5612  std::vector<Token> ExpandFunctionLocalPredefinedMacros(ArrayRef<Token> Toks);
5613 
5617 
5618  bool CheckLoopHintExpr(Expr *E, SourceLocation Loc, bool AllowZero);
5619 
5620  ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope = nullptr);
5622  Scope *UDLScope = nullptr);
5625  MultiExprArg Val);
5626 
5627  /// ActOnStringLiteral - The specified tokens were lexed as pasted string
5628  /// fragments (e.g. "foo" "bar" L"baz").
5630  Scope *UDLScope = nullptr);
5631 
5633 
5634  /// ControllingExprOrType is either an opaque pointer coming out of a
5635  /// ParsedType or an Expr *. FIXME: it'd be better to split this interface
5636  /// into two so we don't take a void *, but that's awkward because one of
5637  /// the operands is either a ParsedType or an Expr *, which doesn't lend
5638  /// itself to generic code very well.
5640  SourceLocation DefaultLoc,
5641  SourceLocation RParenLoc,
5642  bool PredicateIsExpr,
5643  void *ControllingExprOrType,
5644  ArrayRef<ParsedType> ArgTypes,
5645  ArrayRef<Expr *> ArgExprs);
5646  /// ControllingExprOrType is either a TypeSourceInfo * or an Expr *. FIXME:
5647  /// it'd be better to split this interface into two so we don't take a
5648  /// void *, but see the FIXME on ActOnGenericSelectionExpr as to why that
5649  /// isn't a trivial change.
5651  SourceLocation DefaultLoc,
5652  SourceLocation RParenLoc,
5653  bool PredicateIsExpr,
5654  void *ControllingExprOrType,
5656  ArrayRef<Expr *> Exprs);
5657 
5658  // Binary/Unary Operators. 'Tok' is the token for the operator.
5660  Expr *InputExpr, bool IsAfterAmp = false);
5662  Expr *Input, bool IsAfterAmp = false);
5664  Expr *Input, bool IsAfterAmp = false);
5665 
5666  bool isQualifiedMemberAccess(Expr *E);
5668  const Expr *Op,
5669  const CXXMethodDecl *MD);
5670 
5672 
5673  bool ActOnAlignasTypeArgument(StringRef KWName, ParsedType Ty,
5674  SourceLocation OpLoc, SourceRange R);
5675  bool CheckAlignasTypeArgument(StringRef KWName, TypeSourceInfo *TInfo,
5676  SourceLocation OpLoc, SourceRange R);
5677 
5679  SourceLocation OpLoc,
5680  UnaryExprOrTypeTrait ExprKind,
5681  SourceRange R);
5683  UnaryExprOrTypeTrait ExprKind);
5685  UnaryExprOrTypeTrait ExprKind,
5686  bool IsType, void *TyOrEx,
5687  SourceRange ArgRange);
5688 
5690  bool CheckVecStepExpr(Expr *E);
5691 
5694  SourceRange ExprRange,
5695  UnaryExprOrTypeTrait ExprKind,
5696  StringRef KWName);
5697 
5699  tok::TokenKind Kind, Expr *Input);
5700 
5702  MultiExprArg ArgExprs,
5703  SourceLocation RLoc);
5705  Expr *Idx, SourceLocation RLoc);
5706 
5708  Expr *ColumnIdx,
5709  SourceLocation RBLoc);
5710 
5711  bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, FunctionDecl *FDecl,
5712  const FunctionProtoType *Proto,
5713  ArrayRef<Expr *> Args, SourceLocation RParenLoc,
5714  bool ExecConfig = false);
5716  const Expr *ArgExpr);
5717 
5718  /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
5719  /// This provides the location of the left/right parens and a list of comma
5720  /// locations.
5721  ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc,
5722  MultiExprArg ArgExprs, SourceLocation RParenLoc,
5723  Expr *ExecConfig = nullptr);
5724  ExprResult BuildCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc,
5725  MultiExprArg ArgExprs, SourceLocation RParenLoc,
5726  Expr *ExecConfig = nullptr,
5727  bool IsExecConfig = false,
5728  bool AllowRecovery = false);
5730  MultiExprArg CallArgs);
5731 
5733 
5734  ExprResult
5735  BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc,
5736  ArrayRef<Expr *> Arg, SourceLocation RParenLoc,
5737  Expr *Config = nullptr, bool IsExecConfig = false,
5738  ADLCallKind UsesADL = ADLCallKind::NotADL);
5739 
5741  ParsedType &Ty, SourceLocation RParenLoc,
5742  Expr *CastExpr);
5743 
5745 
5746  /// Build an altivec or OpenCL literal.
5748  SourceLocation RParenLoc, Expr *E,
5749  TypeSourceInfo *TInfo);
5750 
5752 
5754  SourceLocation RParenLoc, Expr *InitExpr);
5755 
5757  TypeSourceInfo *TInfo,
5758  SourceLocation RParenLoc,
5759  Expr *LiteralExpr);
5760 
5761  ExprResult ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList,
5762  SourceLocation RBraceLoc);
5763 
5764  ExprResult BuildInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList,
5765  SourceLocation RBraceLoc);
5766 
5768  Expr *LHSExpr, Expr *RHSExpr);
5770  Expr *LHSExpr, Expr *RHSExpr);
5772  Expr *LHSExpr, Expr *RHSExpr);
5773  void LookupBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc,
5774  UnresolvedSetImpl &Functions);
5775 
5776  void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc);
5777 
5778  /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
5779  /// in the case of a the GNU conditional expr extension.
5781  SourceLocation ColonLoc, Expr *CondExpr,
5782  Expr *LHSExpr, Expr *RHSExpr);
5783 
5784  /// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
5786  LabelDecl *TheDecl);
5787 
5788  void ActOnStartStmtExpr();
5789  ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt,
5790  SourceLocation RPLoc);
5791  ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt,
5792  SourceLocation RPLoc, unsigned TemplateDepth);
5793  // Handle the final expression in a statement expression.
5795  void ActOnStmtExprError();
5796 
5797  // __builtin_offsetof(type, identifier(.identifier|[expr])*)
5800  bool isBrackets; // true if [expr], false if .ident
5801  union {
5804  } U;
5805  };
5806 
5807  /// __builtin_offsetof(type, a.b[123][456].c)
5809  TypeSourceInfo *TInfo,
5810  ArrayRef<OffsetOfComponent> Components,
5811  SourceLocation RParenLoc);
5814  ParsedType ParsedArgTy,
5815  ArrayRef<OffsetOfComponent> Components,
5816  SourceLocation RParenLoc);
5817 
5818  // __builtin_choose_expr(constExpr, expr1, expr2)
5819  ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr,
5820  Expr *LHSExpr, Expr *RHSExpr,
5821  SourceLocation RPLoc);
5822 
5823  // __builtin_va_arg(expr, type)
5824  ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty,
5825  SourceLocation RPLoc);
5827  TypeSourceInfo *TInfo, SourceLocation RPLoc);
5828 
5829  // __builtin_LINE(), __builtin_FUNCTION(), __builtin_FUNCSIG(),
5830  // __builtin_FILE(), __builtin_COLUMN(), __builtin_source_location()
5832  SourceLocation BuiltinLoc,
5833  SourceLocation RPLoc);
5834 
5835  // Build a potentially resolved SourceLocExpr.
5837  SourceLocation BuiltinLoc, SourceLocation RPLoc,
5838  DeclContext *ParentContext);
5839 
5840  // __null
5842 
5843  bool CheckCaseExpression(Expr *E);
5844 
5845  //===------------------------- "Block" Extension ------------------------===//
5846 
5847  /// ActOnBlockStart - This callback is invoked when a block literal is
5848  /// started.
5849  void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope);
5850 
5851  /// ActOnBlockArguments - This callback allows processing of block arguments.
5852  /// If there are no arguments, this is still invoked.
5853  void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
5854  Scope *CurScope);
5855 
5856  /// ActOnBlockError - If there is an error parsing a block, this callback
5857  /// is invoked to pop the information about the block from the action impl.
5858  void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope);
5859 
5860  /// ActOnBlockStmtExpr - This is called when the body of a block statement
5861  /// literal was successfully completed. ^(int x){...}
5863  Scope *CurScope);
5864 
5865  //===---------------------------- Clang Extensions ----------------------===//
5866 
5867  /// __builtin_convertvector(...)
5869  SourceLocation BuiltinLoc,
5870  SourceLocation RParenLoc);
5871 
5872  //===---------------------------- OpenCL Features -----------------------===//
5873 
5874  /// __builtin_astype(...)
5875  ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy,
5876  SourceLocation BuiltinLoc,
5877  SourceLocation RParenLoc);
5879  SourceLocation BuiltinLoc,
5880  SourceLocation RParenLoc);
5881 
5882  /// Attempts to produce a RecoveryExpr after some AST node cannot be created.
5884  ArrayRef<Expr *> SubExprs,
5885  QualType T = QualType());
5886 
5887  // Note that LK_String is intentionally after the other literals, as
5888  // this is used for diagnostics logic.
5896  LK_None
5897  };
5899 
5901  NestedNameSpecifier *Qualifier,
5902  NamedDecl *FoundDecl,
5903  NamedDecl *Member);
5904 
5905  /// CheckCallReturnType - Checks that a call expression's return type is
5906  /// complete. Returns true on failure. The location passed in is the location
5907  /// that best represents the call.
5908  bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc,
5909  CallExpr *CE, FunctionDecl *FD);
5910 
5911  /// Emit a warning for all pending noderef expressions that we recorded.
5912  void WarnOnPendingNoDerefs(ExpressionEvaluationContextRecord &Rec);
5913 
5915 
5916  /// Instantiate or parse a C++ default argument expression as necessary.
5917  /// Return true on error.
5919  ParmVarDecl *Param, Expr *Init = nullptr,
5920  bool SkipImmediateInvocations = true);
5921 
5922  /// BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating
5923  /// the default expr if needed.
5925  ParmVarDecl *Param, Expr *Init = nullptr);
5926 
5927  /// Wrap the expression in a ConstantExpr if it is a potential immediate
5928  /// invocation.
5930 
5932 
5933  bool IsInvalidSMECallConversion(QualType FromType, QualType ToType);
5934 
5936  const DeclContext *DC = getCurLexicalContext();
5937  // A category implicitly has the attribute of the interface.
5938  if (const ObjCCategoryDecl *CatD = dyn_cast<ObjCCategoryDecl>(DC))
5939  DC = CatD->getClassInterface();
5940  return DC;
5941  }
5942 
5943  /// Abstract base class used for diagnosing integer constant
5944  /// expression violations.
5946  public:
5947  bool Suppress;
5948 
5949  VerifyICEDiagnoser(bool Suppress = false) : Suppress(Suppress) {}
5950 
5951  virtual SemaDiagnosticBuilder
5952  diagnoseNotICEType(Sema &S, SourceLocation Loc, QualType T);
5954  SourceLocation Loc) = 0;
5955  virtual SemaDiagnosticBuilder diagnoseFold(Sema &S, SourceLocation Loc);
5956  virtual ~VerifyICEDiagnoser() {}
5957  };
5958 
5962  };
5963 
5964  /// VerifyIntegerConstantExpression - Verifies that an expression is an ICE,
5965  /// and reports the appropriate diagnostics. Returns false on success.
5966  /// Can optionally return the value of the expression.
5968  VerifyICEDiagnoser &Diagnoser,
5969  AllowFoldKind CanFold = NoFold);
5971  unsigned DiagID,
5972  AllowFoldKind CanFold = NoFold);
5974  llvm::APSInt *Result = nullptr,
5975  AllowFoldKind CanFold = NoFold);
5977  AllowFoldKind CanFold = NoFold) {
5978  return VerifyIntegerConstantExpression(E, nullptr, CanFold);
5979  }
5980 
5981  /// DiagnoseAssignmentAsCondition - Given that an expression is
5982  /// being used as a boolean condition, warn if it's an assignment.
5984 
5985  /// Redundant parentheses over an equality comparison can indicate
5986  /// that the user intended an assignment used as condition.
5988 
5989  class FullExprArg {
5990  public:
5991  FullExprArg() : E(nullptr) {}
5992  FullExprArg(Sema &actions) : E(nullptr) {}
5993 
5994  ExprResult release() { return E; }
5995 
5996  Expr *get() const { return E; }
5997 
5998  Expr *operator->() { return E; }
5999 
6000  private:
6001  // FIXME: No need to make the entire Sema class a friend when it's just
6002  // Sema::MakeFullExpr that needs access to the constructor below.
6003  friend class Sema;
6004 
6005  explicit FullExprArg(Expr *expr) : E(expr) {}
6006 
6007  Expr *E;
6008  };
6009 
6011  return MakeFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation());
6012  }
6014  return FullExprArg(
6015  ActOnFinishFullExpr(Arg, CC, /*DiscardedValue*/ false).get());
6016  }
6018  ExprResult FE =
6019  ActOnFinishFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation(),
6020  /*DiscardedValue*/ true);
6021  return FullExprArg(FE.get());
6022  }
6023 
6025  Decl *ConditionVar;
6027  bool Invalid;
6028  std::optional<bool> KnownValue;
6029 
6030  friend class Sema;
6031  ConditionResult(Sema &S, Decl *ConditionVar, FullExprArg Condition,
6032  bool IsConstexpr)
6033  : ConditionVar(ConditionVar), Condition(Condition), Invalid(false) {
6034  if (IsConstexpr && Condition.get()) {
6035  if (std::optional<llvm::APSInt> Val =
6036  Condition.get()->getIntegerConstantExpr(S.Context)) {
6037  KnownValue = !!(*Val);
6038  }
6039  }
6040  }
6041  explicit ConditionResult(bool Invalid)
6042  : ConditionVar(nullptr), Condition(nullptr), Invalid(Invalid),
6043  KnownValue(std::nullopt) {}
6044 
6045  public:
6047  bool isInvalid() const { return Invalid; }
6048  std::pair<VarDecl *, Expr *> get() const {
6049  return std::make_pair(cast_or_null<VarDecl>(ConditionVar),
6050  Condition.get());
6051  }
6052  std::optional<bool> getKnownValue() const { return KnownValue; }
6053  };
6055 
6056  /// CheckBooleanCondition - Diagnose problems involving the use of
6057  /// the given expression as a boolean condition (e.g. in an if
6058  /// statement). Also performs the standard function and array
6059  /// decays, possibly changing the input variable.
6060  ///
6061  /// \param Loc - A location associated with the condition, e.g. the
6062  /// 'if' keyword.
6063  /// \return true iff there were any errors
6065  bool IsConstexpr = false);
6066 
6067  enum class ConditionKind {
6068  Boolean, ///< A boolean condition, from 'if', 'while', 'for', or 'do'.
6069  ConstexprIf, ///< A constant boolean condition from 'if constexpr'.
6070  Switch ///< An integral condition for a 'switch' statement.
6071  };
6072 
6073  ConditionResult ActOnCondition(Scope *S, SourceLocation Loc, Expr *SubExpr,
6074  ConditionKind CK, bool MissingOK = false);
6075 
6076  QualType CheckConditionalOperands( // C99 6.5.15
6077  ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK,
6078  ExprObjectKind &OK, SourceLocation QuestionLoc);
6079 
6081  SourceLocation QuestionLoc);
6082 
6083  bool DiagnoseConditionalForNull(const Expr *LHSExpr, const Expr *RHSExpr,
6084  SourceLocation QuestionLoc);
6085 
6086  /// type checking for vector binary operators.
6088  SourceLocation Loc, bool IsCompAssign,
6089  bool AllowBothBool, bool AllowBoolConversion,
6090  bool AllowBoolOperation, bool ReportInvalid);
6094  SourceLocation Loc,
6095  BinaryOperatorKind Opc);
6097  SourceLocation Loc,
6098  BinaryOperatorKind Opc);
6100  SourceLocation Loc);
6101 
6102  /// Context in which we're performing a usual arithmetic conversion.
6104  /// An arithmetic operation.
6106  /// A bitwise operation.
6108  /// A comparison.
6110  /// A conditional (?:) operator.
6112  /// A compound assignment expression.
6114  };
6115 
6116  // type checking for sizeless vector binary operators.
6118  SourceLocation Loc, bool IsCompAssign,
6119  ArithConvKind OperationKind);
6120 
6121  /// Type checking for matrix binary operators.
6123  SourceLocation Loc,
6124  bool IsCompAssign);
6126  SourceLocation Loc, bool IsCompAssign);
6127 
6128  bool isValidSveBitcast(QualType srcType, QualType destType);
6129  bool isValidRVVBitcast(QualType srcType, QualType destType);
6130 
6132 
6133  bool areVectorTypesSameSize(QualType srcType, QualType destType);
6134  bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType);
6135  bool isLaxVectorConversion(QualType srcType, QualType destType);
6136  bool anyAltivecTypes(QualType srcType, QualType destType);
6137 
6138  // type checking C++ declaration initializers (C++ [dcl.init]).
6139 
6142  ExprValueKind &VK, CXXCastPath &Path);
6143 
6144  /// Force an expression with unknown-type to an expression of the
6145  /// given type.
6147 
6148  /// Type-check an expression that's being passed to an
6149  /// __unknown_anytype parameter.
6151  QualType &paramType);
6152 
6153  // CheckMatrixCast - Check type constraints for matrix casts.
6154  // We allow casting between matrixes of the same dimensions i.e. when they
6155  // have the same number of rows and column. Returns true if the cast is
6156  // invalid.
6157  bool CheckMatrixCast(SourceRange R, QualType DestTy, QualType SrcTy,
6158  CastKind &Kind);
6159 
6160  // CheckVectorCast - check type constraints for vectors.
6161  // Since vectors are an extension, there are no C standard reference for this.
6162  // We allow casting between vectors and integer datatypes of the same size.
6163  // returns true if the cast is invalid
6164  bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty,
6165  CastKind &Kind);
6166 
6167  /// Prepare `SplattedExpr` for a vector splat operation, adding
6168  /// implicit casts if necessary.
6169  ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr);
6170 
6171  // CheckExtVectorCast - check type constraints for extended vectors.
6172  // Since vectors are an extension, there are no C standard reference for this.
6173  // We allow casting between vectors and integer datatypes of the same size,
6174  // or vectors and the element type of that vector.
6175  // returns the cast expr
6177  CastKind &Kind);
6178 
6181  }
6182 
6183  // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts
6184  // functions and arrays to their respective pointers (C99 6.3.2.1).
6186 
6187  /// CallExprUnaryConversions - a special case of an unary conversion
6188  /// performed on a function designator of a call expression.
6190 
6191  // DefaultFunctionArrayConversion - converts functions and arrays
6192  // to their respective pointers (C99 6.3.2.1).
6193  ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose = true);
6194 
6195  // DefaultFunctionArrayLvalueConversion - converts functions and
6196  // arrays to their respective pointers and performs the
6197  // lvalue-to-rvalue conversion.
6199  bool Diagnose = true);
6200 
6201  // DefaultLvalueConversion - performs lvalue-to-rvalue conversion on
6202  // the operand. This function is a no-op if the operand has a function type
6203  // or an array type.
6205 
6206  // DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that
6207  // do not have a prototype. Integer promotions are performed on each
6208  // argument, and arguments that have type float are promoted to double.
6210 
6212  const FunctionProtoType *Proto,
6213  Expr *Fn);
6214 
6215  // Used for determining in which context a type is allowed to be passed to a
6216  // vararg function.
6217  enum VarArgKind {
6222  VAK_Invalid
6223  };
6224 
6225  // Determines which VarArgKind fits an expression.
6227 
6228  /// Check to see if the given expression is a valid argument to a variadic
6229  /// function, issuing a diagnostic if not.
6230  void checkVariadicArgument(const Expr *E, VariadicCallType CT);
6231 
6232  /// GatherArgumentsForCall - Collector argument expressions for various
6233  /// form of call prototypes.
6234  bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl,
6235  const FunctionProtoType *Proto,
6236  unsigned FirstParam, ArrayRef<Expr *> Args,
6237  SmallVectorImpl<Expr *> &AllArgs,
6239  bool AllowExplicit = false,
6240  bool IsListInitialization = false);
6241 
6242  // DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but
6243  // will create a runtime trap if the resulting type is not a POD type.
6245  FunctionDecl *FDecl);
6246 
6247  // UsualArithmeticConversions - performs the UsualUnaryConversions on it's
6248  // operands and then handles various conversions that are common to binary
6249  // operators (C99 6.3.1.8). If both operands aren't arithmetic, this
6250  // routine returns the first non-arithmetic type found. The client is
6251  // responsible for emitting appropriate error diagnostics.
6253  SourceLocation Loc, ArithConvKind ACK);
6254 
6255  /// AssignConvertType - All of the 'assignment' semantic checks return this
6256  /// enum to indicate whether the assignment was allowed. These checks are
6257  /// done for simple assignments, as well as initialization, return from
6258  /// function, argument passing, etc. The query is phrased in terms of a
6259  /// source and destination type.
6261  /// Compatible - the types are compatible according to the standard.
6263 
6264  /// PointerToInt - The assignment converts a pointer to an int, which we
6265  /// accept as an extension.
6267 
6268  /// IntToPointer - The assignment converts an int to a pointer, which we
6269  /// accept as an extension.
6271 
6272  /// FunctionVoidPointer - The assignment is between a function pointer and
6273  /// void*, which the standard doesn't allow, but we accept as an extension.
6275 
6276  /// IncompatiblePointer - The assignment is between two pointers types that
6277  /// are not compatible, but we accept them as an extension.
6279 
6280  /// IncompatibleFunctionPointer - The assignment is between two function
6281  /// pointers types that are not compatible, but we accept them as an
6282  /// extension.
6284 
6285  /// IncompatibleFunctionPointerStrict - The assignment is between two
6286  /// function pointer types that are not identical, but are compatible,
6287  /// unless compiled with -fsanitize=cfi, in which case the type mismatch
6288  /// may trip an indirect call runtime check.
6290 
6291  /// IncompatiblePointerSign - The assignment is between two pointers types
6292  /// which point to integers which have a different sign, but are otherwise
6293  /// identical. This is a subset of the above, but broken out because it's by
6294  /// far the most common case of incompatible pointers.
6296 
6297  /// CompatiblePointerDiscardsQualifiers - The assignment discards
6298  /// c/v/r qualifiers, which we accept as an extension.
6300 
6301  /// IncompatiblePointerDiscardsQualifiers - The assignment
6302  /// discards qualifiers that we don't permit to be discarded,
6303  /// like address spaces.
6305 
6306  /// IncompatibleNestedPointerAddressSpaceMismatch - The assignment
6307  /// changes address spaces in nested pointer types which is not allowed.
6308  /// For instance, converting __private int ** to __generic int ** is
6309  /// illegal even though __private could be converted to __generic.
6311 
6312  /// IncompatibleNestedPointerQualifiers - The assignment is between two
6313  /// nested pointer types, and the qualifiers other than the first two
6314  /// levels differ e.g. char ** -> const char **, but we accept them as an
6315  /// extension.
6317 
6318  /// IncompatibleVectors - The assignment is between two vector types that
6319  /// have the same size, which we accept as an extension.
6321 
6322  /// IntToBlockPointer - The assignment converts an int to a block
6323  /// pointer. We disallow this.
6325 
6326  /// IncompatibleBlockPointer - The assignment is between two block
6327  /// pointers types that are not compatible.
6329 
6330  /// IncompatibleObjCQualifiedId - The assignment is between a qualified
6331  /// id type and something else (that is incompatible with it). For example,
6332  /// "id <XXX>" = "Foo *", where "Foo *" doesn't implement the XXX protocol.
6334 
6335  /// IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an
6336  /// object with __weak qualifier.
6338 
6339  /// Incompatible - We reject this conversion outright, it is invalid to
6340  /// represent it in the AST.
6341  Incompatible
6342  };
6343 
6344  /// DiagnoseAssignmentResult - Emit a diagnostic, if required, for the
6345  /// assignment conversion type specified by ConvTy. This returns true if the
6346  /// conversion was invalid or false if the conversion was accepted.
6348  QualType DstType, QualType SrcType,
6349  Expr *SrcExpr, AssignmentAction Action,
6350  bool *Complained = nullptr);
6351 
6352  /// CheckAssignmentConstraints - Perform type checking for assignment,
6353  /// argument passing, variable initialization, and function return values.
6354  /// C99 6.5.16.
6356  QualType LHSType,
6357  QualType RHSType);
6358 
6359  /// Check assignment constraints and optionally prepare for a conversion of
6360  /// the RHS to the LHS type. The conversion is prepared for if ConvertRHS
6361  /// is true.
6363  ExprResult &RHS, CastKind &Kind,
6364  bool ConvertRHS = true);
6365 
6366  /// Check assignment constraints for an assignment of RHS to LHSType.
6367  ///
6368  /// \param LHSType The destination type for the assignment.
6369  /// \param RHS The source expression for the assignment.
6370  /// \param Diagnose If \c true, diagnostics may be produced when checking
6371  /// for assignability. If a diagnostic is produced, \p RHS will be
6372  /// set to ExprError(). Note that this function may still return
6373  /// without producing a diagnostic, even for an invalid assignment.
6374  /// \param DiagnoseCFAudited If \c true, the target is a function parameter
6375  /// in an audited Core Foundation API and does not need to be checked
6376  /// for ARC retain issues.
6377  /// \param ConvertRHS If \c true, \p RHS will be updated to model the
6378  /// conversions necessary to perform the assignment. If \c false,
6379  /// \p Diagnose must also be \c false.
6381  QualType LHSType, ExprResult &RHS, bool Diagnose = true,
6382  bool DiagnoseCFAudited = false, bool ConvertRHS = true);
6383 
6384  // If the lhs type is a transparent union, check whether we
6385  // can initialize the transparent union with the given expression.
6387  ExprResult &RHS);
6388 
6389  /// the following "Check" methods will return a valid/converted QualType
6390  /// or a null QualType (indicating an error diagnostic was issued).
6391 
6392  /// type checking binary operators (subroutines of CreateBuiltinBinOp).
6394  ExprResult &RHS);
6396  ExprResult &RHS);
6397 
6399  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign,
6400  bool IsDivide);
6401  QualType CheckRemainderOperands( // C99 6.5.5
6402  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
6403  bool IsCompAssign = false);
6404  QualType CheckAdditionOperands( // C99 6.5.6
6405  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
6406  BinaryOperatorKind Opc, QualType *CompLHSTy = nullptr);
6407  QualType CheckSubtractionOperands( // C99 6.5.6
6408  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
6409  QualType *CompLHSTy = nullptr);
6410  QualType CheckShiftOperands( // C99 6.5.7
6411  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
6412  BinaryOperatorKind Opc, bool IsCompAssign = false);
6414  QualType CheckCompareOperands( // C99 6.5.8/9
6415  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
6416  BinaryOperatorKind Opc);
6417  QualType CheckBitwiseOperands( // C99 6.5.[10...12]
6418  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
6419  BinaryOperatorKind Opc);
6420  QualType CheckLogicalOperands( // C99 6.5.[13,14]
6421  ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
6422  BinaryOperatorKind Opc);
6423  // CheckAssignmentOperands is used for both simple and compound assignment.
6424  // For simple assignment, pass both expressions and a null converted type.
6425  // For compound assignment, pass both expressions and the converted type.
6426  QualType CheckAssignmentOperands( // C99 6.5.16.[1,2]
6427  Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType,
6428  BinaryOperatorKind Opc);
6429 
6430  bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr,
6431  bool Diagnose = true);
6432 
6433  /// To be used for checking whether the arguments being passed to
6434  /// function exceeds the number of parameters expected for it.
6435  static bool TooManyArguments(size_t NumParams, size_t NumArgs,
6436  bool PartialOverloading = false) {
6437  // We check whether we're just after a comma in code-completion.
6438  if (NumArgs > 0 && PartialOverloading)
6439  return NumArgs + 1 > NumParams; // If so, we view as an extra argument.
6440  return NumArgs > NumParams;
6441  }
6442 
6443  /// Whether the AST is currently being rebuilt to correct immediate
6444  /// invocations. Immediate invocation candidates and references to consteval
6445  /// functions aren't tracked when this is set.
6447 
6452  }
6453 
6454  /// Determines whether we are currently in a context that
6455  /// is not evaluated as per C++ [expr] p5.
6456  bool isUnevaluatedContext() const {
6458  }
6459 
6462  }
6463 
6465  assert(!ExprEvalContexts.empty() &&
6466  "Must be in an expression evaluation context");
6467  return ExprEvalContexts.back().InLifetimeExtendingContext;
6468  }
6469 
6472  return (Ctx.Context ==
6475  }
6476 
6477  std::optional<ExpressionEvaluationContextRecord::InitializationContext>
6479  assert(!ExprEvalContexts.empty() &&
6480  "Must be in an expression evaluation context");
6481  for (const auto &Ctx : llvm::reverse(ExprEvalContexts)) {
6483  Ctx.DelayedDefaultInitializationContext)
6484  return Ctx.DelayedDefaultInitializationContext;
6485  if (Ctx.isConstantEvaluated() || Ctx.isImmediateFunctionContext() ||
6486  Ctx.isUnevaluated())
6487  break;
6488  }
6489  return std::nullopt;
6490  }
6491 
6492  std::optional<ExpressionEvaluationContextRecord::InitializationContext>
6494  assert(!ExprEvalContexts.empty() &&
6495  "Must be in an expression evaluation context");
6496  std::optional<ExpressionEvaluationContextRecord::InitializationContext> Res;
6497  for (auto &Ctx : llvm::reverse(ExprEvalContexts)) {
6499  !Ctx.DelayedDefaultInitializationContext && Res)
6500  break;
6501  if (Ctx.isConstantEvaluated() || Ctx.isImmediateFunctionContext() ||
6502  Ctx.isUnevaluated())
6503  break;
6504  Res = Ctx.DelayedDefaultInitializationContext;
6505  }
6506  return Res;
6507  }
6508 
6509  /// keepInLifetimeExtendingContext - Pull down InLifetimeExtendingContext
6510  /// flag from previous context.
6512  if (ExprEvalContexts.size() > 2 &&
6514  .InLifetimeExtendingContext) {
6515  auto &LastRecord = ExprEvalContexts.back();
6516  auto &PrevRecord = ExprEvalContexts[ExprEvalContexts.size() - 2];
6517  LastRecord.InLifetimeExtendingContext =
6518  PrevRecord.InLifetimeExtendingContext;
6519  }
6520  }
6521 
6524  }
6525 
6526  /// Returns a field in a CXXRecordDecl that has the same name as the decl \p
6527  /// SelfAssigned when inside a CXXMethodDecl.
6528  const FieldDecl *
6529  getSelfAssignmentClassMemberCandidate(const ValueDecl *SelfAssigned);
6530 
6532 
6533  template <typename... Ts>
6535  const Ts &...Args) {
6536  SizelessTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
6537  return RequireCompleteType(Loc, T, CompleteTypeKind::Normal, Diagnoser);
6538  }
6539 
6540  template <typename... Ts>
6541  bool RequireCompleteSizedExprType(Expr *E, unsigned DiagID,
6542  const Ts &...Args) {
6543  SizelessTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
6544  return RequireCompleteExprType(E, CompleteTypeKind::Normal, Diagnoser);
6545  }
6546 
6547  /// Abstract class used to diagnose incomplete types.
6548  struct TypeDiagnoser {
6550 
6551  virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) = 0;
6552  virtual ~TypeDiagnoser() {}
6553  };
6554 
6555  template <typename... Ts> class BoundTypeDiagnoser : public TypeDiagnoser {
6556  protected:
6557  unsigned DiagID;
6558  std::tuple<const Ts &...> Args;
6559 
6560  template <std::size_t... Is>
6561  void emit(const SemaDiagnosticBuilder &DB,
6562  std::index_sequence<Is...>) const {
6563  // Apply all tuple elements to the builder in order.
6564  bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
6565  (void)Dummy;
6566  }
6567 
6568  public:
6569  BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
6570  : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
6571  assert(DiagID != 0 && "no diagnostic for type diagnoser");
6572  }
6573 
6574  void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
6575  const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
6576  emit(DB, std::index_sequence_for<Ts...>());
6577  DB << T;
6578  }
6579  };
6580 
6581  /// A derivative of BoundTypeDiagnoser for which the diagnostic's type
6582  /// parameter is preceded by a 0/1 enum that is 1 if the type is sizeless.
6583  /// For example, a diagnostic with no other parameters would generally have
6584  /// the form "...%select{incomplete|sizeless}0 type %1...".
6585  template <typename... Ts>
6587  public:
6588  SizelessTypeDiagnoser(unsigned DiagID, const Ts &...Args)
6589  : BoundTypeDiagnoser<Ts...>(DiagID, Args...) {}
6590 
6591  void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
6592  const SemaDiagnosticBuilder &DB = S.Diag(Loc, this->DiagID);
6593  this->emit(DB, std::index_sequence_for<Ts...>());
6594  DB << T->isSizelessType() << T;
6595  }
6596  };
6597 
6598  /// Check an argument list for placeholders that we won't try to
6599  /// handle later.
6601 
6602  /// The C++ "std::source_location::__impl" struct, defined in
6603  /// <source_location>.
6605 
6606  /// A stack of expression evaluation contexts.
6608 
6609  // Set of failed immediate invocations to avoid double diagnosing.
6611 
6612  /// List of SourceLocations where 'self' is implicitly retained inside a
6613  /// block.
6616 
6617 private:
6618  static BinaryOperatorKind ConvertTokenKindToBinaryOpcode(tok::TokenKind Kind);
6619 
6620  /// Methods for marking which expressions involve dereferencing a pointer
6621  /// marked with the 'noderef' attribute. Expressions are checked bottom up as
6622  /// they are parsed, meaning that a noderef pointer may not be accessed. For
6623  /// example, in `&*p` where `p` is a noderef pointer, we will first parse the
6624  /// `*p`, but need to check that `address of` is called on it. This requires
6625  /// keeping a container of all pending expressions and checking if the address
6626  /// of them are eventually taken.
6627  void CheckSubscriptAccessOfNoDeref(const ArraySubscriptExpr *E);
6628  void CheckAddressOfNoDeref(const Expr *E);
6629 
6630  ///@}
6631 
6632  //
6633  //
6634  // -------------------------------------------------------------------------
6635  //
6636  //
6637 
6638  /// \name C++ Expressions
6639  /// Implementations are in SemaExprCXX.cpp
6640  ///@{
6641 
6642 public:
6643  /// The C++ "std::bad_alloc" class, which is defined by the C++
6644  /// standard library.
6646 
6647  /// The C++ "std::align_val_t" enum class, which is defined by the C++
6648  /// standard library.
6650 
6651  /// The C++ "type_info" declaration, which is defined in <typeinfo>.
6653 
6654  /// A flag to remember whether the implicit forms of operator new and delete
6655  /// have been declared.
6657 
6658  /// Delete-expressions to be analyzed at the end of translation unit
6659  ///
6660  /// This list contains class members, and locations of delete-expressions
6661  /// that could not be proven as to whether they mismatch with new-expression
6662  /// used in initializer of the field.
6663  llvm::MapVector<FieldDecl *, DeleteLocs> DeleteExprs;
6664 
6666  SourceLocation NameLoc,
6667  const IdentifierInfo &Name);
6668 
6670  SourceLocation NameLoc, Scope *S,
6671  CXXScopeSpec &SS, bool EnteringContext);
6673  Scope *S, CXXScopeSpec &SS,
6674  ParsedType ObjectType, bool EnteringContext);
6675 
6677  ParsedType ObjectType);
6678 
6679  ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc,
6680  TypeSourceInfo *Operand, SourceLocation RParenLoc);
6681  ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc,
6682  Expr *Operand, SourceLocation RParenLoc);
6683 
6684  /// ActOnCXXTypeid - Parse typeid( something ).
6686  bool isType, void *TyOrExpr,
6687  SourceLocation RParenLoc);
6688 
6689  ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc,
6690  TypeSourceInfo *Operand, SourceLocation RParenLoc);
6691  ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc,
6692  Expr *Operand, SourceLocation RParenLoc);
6693 
6694  /// ActOnCXXUuidof - Parse __uuidof( something ).
6696  bool isType, void *TyOrExpr,
6697  SourceLocation RParenLoc);
6698 
6699  //// ActOnCXXThis - Parse 'this' pointer.
6701 
6702  /// Check whether the type of 'this' is valid in the current context.
6704 
6705  /// Build a CXXThisExpr and mark it referenced in the current context.
6706  Expr *BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit);
6708 
6709  /// Try to retrieve the type of the 'this' pointer.
6710  ///
6711  /// \returns The type of 'this', if possible. Otherwise, returns a NULL type.
6713 
6714  /// When non-NULL, the C++ 'this' expression is allowed despite the
6715  /// current context not being a non-static member function. In such cases,
6716  /// this provides the type used for 'this'.
6718 
6719  /// RAII object used to temporarily allow the C++ 'this' expression
6720  /// to be used, with the given qualifiers on the current class type.
6722  Sema &S;
6723  QualType OldCXXThisTypeOverride;
6724  bool Enabled;
6725 
6726  public:
6727  /// Introduce a new scope where 'this' may be allowed (when enabled),
6728  /// using the given declaration (which is either a class template or a
6729  /// class) along with the given qualifiers.
6730  /// along with the qualifiers placed on '*this'.
6731  CXXThisScopeRAII(Sema &S, Decl *ContextDecl, Qualifiers CXXThisTypeQuals,
6732  bool Enabled = true);
6733 
6734  ~CXXThisScopeRAII();
6735  };
6736 
6737  /// Make sure the value of 'this' is actually available in the current
6738  /// context, if it is a potentially evaluated context.
6739  ///
6740  /// \param Loc The location at which the capture of 'this' occurs.
6741  ///
6742  /// \param Explicit Whether 'this' is explicitly captured in a lambda
6743  /// capture list.
6744  ///
6745  /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
6746  /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
6747  /// This is useful when enclosing lambdas must speculatively capture
6748  /// 'this' that may or may not be used in certain specializations of
6749  /// a nested generic lambda (depending on whether the name resolves to
6750  /// a non-static member function or a static function).
6751  /// \return returns 'true' if failed, 'false' if success.
6752  bool CheckCXXThisCapture(
6753  SourceLocation Loc, bool Explicit = false, bool BuildAndDiagnose = true,
6754  const unsigned *const FunctionScopeIndexToStopAt = nullptr,
6755  bool ByCopy = false);
6756 
6757  /// Determine whether the given type is the type of *this that is used
6758  /// outside of the body of a member function for a type that is currently
6759  /// being defined.
6761 
6762  /// ActOnCXXBoolLiteral - Parse {true,false} literals.
6764 
6765  /// ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
6767 
6768  ExprResult
6770  SourceLocation AtLoc, SourceLocation RParen);
6771 
6772  /// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
6774 
6775  //// ActOnCXXThrow - Parse throw expressions.
6778  bool IsThrownVarInScope);
6779  bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E);
6780 
6781  /// ActOnCXXTypeConstructExpr - Parse construction of a specified type.
6782  /// Can be interpreted either as function-style casting ("int(x)")
6783  /// or class type construction ("ClassType(x,y,z)")
6784  /// or creation of a value-initialized type ("int()").
6786  SourceLocation LParenOrBraceLoc,
6787  MultiExprArg Exprs,
6788  SourceLocation RParenOrBraceLoc,
6789  bool ListInitialization);
6790 
6792  SourceLocation LParenLoc,
6793  MultiExprArg Exprs,
6794  SourceLocation RParenLoc,
6795  bool ListInitialization);
6796 
6797  /// ActOnCXXNew - Parsed a C++ 'new' expression.
6798  ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
6799  SourceLocation PlacementLParen,
6800  MultiExprArg PlacementArgs,
6801  SourceLocation PlacementRParen,
6802  SourceRange TypeIdParens, Declarator &D,
6803  Expr *Initializer);
6804  ExprResult
6805  BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen,
6806  MultiExprArg PlacementArgs, SourceLocation PlacementRParen,
6807  SourceRange TypeIdParens, QualType AllocType,
6808  TypeSourceInfo *AllocTypeInfo, std::optional<Expr *> ArraySize,
6809  SourceRange DirectInitRange, Expr *Initializer);
6810 
6811  /// Determine whether \p FD is an aligned allocation or deallocation
6812  /// function that is unavailable.
6814 
6815  /// Produce diagnostics if \p FD is an aligned allocation or deallocation
6816  /// function that is unavailable.
6818  SourceLocation Loc);
6819 
6820  bool CheckAllocatedType(QualType AllocType, SourceLocation Loc,
6821  SourceRange R);
6822 
6823  /// The scope in which to find allocation functions.
6825  /// Only look for allocation functions in the global scope.
6827  /// Only look for allocation functions in the scope of the
6828  /// allocated class.
6830  /// Look for allocation functions in both the global scope
6831  /// and in the scope of the allocated class.
6832  AFS_Both
6833  };
6834 
6835  /// Finds the overloads of operator new and delete that are appropriate
6836  /// for the allocation.
6837  bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range,
6838  AllocationFunctionScope NewScope,
6839  AllocationFunctionScope DeleteScope,
6840  QualType AllocType, bool IsArray,
6841  bool &PassAlignment, MultiExprArg PlaceArgs,
6842  FunctionDecl *&OperatorNew,
6843  FunctionDecl *&OperatorDelete,
6844  bool Diagnose = true);
6845  void DeclareGlobalNewDelete();
6847  ArrayRef<QualType> Params);
6848 
6850  DeclarationName Name, FunctionDecl *&Operator,
6851  bool Diagnose = true, bool WantSize = false,
6852  bool WantAligned = false);
6854  bool CanProvideSize,
6855  bool Overaligned,
6856  DeclarationName Name);
6858  CXXRecordDecl *RD);
6859 
6860  /// ActOnCXXDelete - Parsed a C++ 'delete' expression
6861  ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
6862  bool ArrayForm, Expr *Operand);
6864  bool IsDelete, bool CallCanBeVirtual,
6865  bool WarnOnNonAbstractTypes,
6866  SourceLocation DtorLoc);
6867 
6869  Expr *Operand, SourceLocation RParen);
6871  SourceLocation RParen);
6872 
6874  SourceLocation OpLoc,
6875  tok::TokenKind OpKind,
6876  ParsedType &ObjectType,
6877  bool &MayBePseudoDestructor);
6878 
6880  Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind,
6882  SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType);
6883 
6885  Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind,
6886  CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc,
6887  SourceLocation TildeLoc, UnqualifiedId &SecondTypeName);
6888 
6890  SourceLocation OpLoc,
6891  tok::TokenKind OpKind,
6892  SourceLocation TildeLoc,
6893  const DeclSpec &DS);
6894 
6895  /// MaybeCreateExprWithCleanups - If the current full-expression
6896  /// requires any cleanups, surround it with a ExprWithCleanups node.
6897  /// Otherwise, just returns the passed-in expression.
6901 
6902  ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue) {
6903  return ActOnFinishFullExpr(
6904  Expr, Expr ? Expr->getExprLoc() : SourceLocation(), DiscardedValue);
6905  }
6907  bool DiscardedValue, bool IsConstexpr = false,
6908  bool IsTemplateArgument = false);
6910 
6912 
6913  bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id,
6914  bool IsUDSuffix);
6915 
6917 
6918  ConditionResult ActOnConditionVariable(Decl *ConditionVar,
6919  SourceLocation StmtLoc,
6920  ConditionKind CK);
6921 
6923  SourceLocation StmtLoc, ConditionKind CK);
6924 
6925  /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
6926  ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr = false);
6927 
6929 
6931  Expr *From, QualType ToType, const ImplicitConversionSequence &ICS,
6932  AssignmentAction Action,
6935  const StandardConversionSequence &SCS,
6936  AssignmentAction Action,
6937  CheckedConversionKind CCK);
6938 
6939  bool CheckTypeTraitArity(unsigned Arity, SourceLocation Loc, size_t N);
6940 
6941  /// Parsed one of the type trait support pseudo-functions.
6943  ArrayRef<ParsedType> Args,
6944  SourceLocation RParenLoc);
6947  SourceLocation RParenLoc);
6948 
6949  /// ActOnArrayTypeTrait - Parsed one of the binary type trait support
6950  /// pseudo-functions.
6952  ParsedType LhsTy, Expr *DimExpr,
6953  SourceLocation RParen);
6954 
6956  TypeSourceInfo *TSInfo, Expr *DimExpr,
6957  SourceLocation RParen);
6958 
6959  /// ActOnExpressionTrait - Parsed one of the unary type trait support
6960  /// pseudo-functions.
6962  Expr *Queried, SourceLocation RParen);
6963 
6965  Expr *Queried, SourceLocation RParen);
6966 
6968  ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, SourceLocation OpLoc,
6969  bool isIndirect);
6971  ExprResult &RHS,
6972  SourceLocation QuestionLoc);
6973 
6975  ExprResult &LHS, ExprResult &RHS,
6976  SourceLocation QuestionLoc);
6977 
6979  ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK,
6980  ExprObjectKind &OK, SourceLocation questionLoc);
6981 
6983  bool ConvertArgs = true);
6985  ExprResult &E2, bool ConvertArgs = true) {
6986  Expr *E1Tmp = E1.get(), *E2Tmp = E2.get();
6987  QualType Composite =
6988  FindCompositePointerType(Loc, E1Tmp, E2Tmp, ConvertArgs);
6989  E1 = E1Tmp;
6990  E2 = E2Tmp;
6991  return Composite;
6992  }
6993 
6994  /// MaybeBindToTemporary - If the passed in expression has a record type with
6995  /// a non-trivial destructor, this will return CXXBindTemporaryExpr. Otherwise
6996  /// it simply returns the passed in expression.
6998 
6999  /// IgnoredValueConversions - Given that an expression's result is
7000  /// syntactically ignored, perform any conversions that are
7001  /// required.
7003 
7005 
7006  /// Process any TypoExprs in the given Expr and its children,
7007  /// generating diagnostics as appropriate and returning a new Expr if there
7008  /// were typos that were all successfully corrected and ExprError if one or
7009  /// more typos could not be corrected.
7010  ///
7011  /// \param E The Expr to check for TypoExprs.
7012  ///
7013  /// \param InitDecl A VarDecl to avoid because the Expr being corrected is its
7014  /// initializer.
7015  ///
7016  /// \param RecoverUncorrectedTypos If true, when typo correction fails, it
7017  /// will rebuild the given Expr with all TypoExprs degraded to RecoveryExprs.
7018  ///
7019  /// \param Filter A function applied to a newly rebuilt Expr to determine if
7020  /// it is an acceptable/usable result from a single combination of typo
7021  /// corrections. As long as the filter returns ExprError, different
7022  /// combinations of corrections will be tried until all are exhausted.
7024  Expr *E, VarDecl *InitDecl = nullptr,
7025  bool RecoverUncorrectedTypos = false,
7026  llvm::function_ref<ExprResult(Expr *)> Filter =
7027  [](Expr *E) -> ExprResult { return E; });
7028 
7030  ExprResult ER, VarDecl *InitDecl = nullptr,
7031  bool RecoverUncorrectedTypos = false,
7032  llvm::function_ref<ExprResult(Expr *)> Filter =
7033  [](Expr *E) -> ExprResult { return E; }) {
7034  return ER.isInvalid()
7035  ? ER
7036  : CorrectDelayedTyposInExpr(ER.get(), InitDecl,
7037  RecoverUncorrectedTypos, Filter);
7038  }
7039 
7040  /// Describes the result of an "if-exists" condition check.
7042  /// The symbol exists.
7044 
7045  /// The symbol does not exist.
7047 
7048  /// The name is a dependent name, so the results will differ
7049  /// from one instantiation to the next.
7051 
7052  /// An error occurred.
7053  IER_Error
7054  };
7055 
7058  const DeclarationNameInfo &TargetNameInfo);
7059 
7061  SourceLocation KeywordLoc,
7062  bool IsIfExists, CXXScopeSpec &SS,
7063  UnqualifiedId &Name);
7064 
7066  ActOnStartRequiresExpr(SourceLocation RequiresKWLoc,
7067  ArrayRef<ParmVarDecl *> LocalParameters,
7068  Scope *BodyScope);
7069  void ActOnFinishRequiresExpr();
7072  CXXScopeSpec &SS,
7073  SourceLocation NameLoc,
7074  const IdentifierInfo *TypeName,
7075  TemplateIdAnnotation *TemplateId);
7077  SourceLocation NoexceptLoc);
7079  Expr *E, SourceLocation NoexceptLoc, CXXScopeSpec &SS,
7083  Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc,
7084  concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement);
7087  bool IsSatisfied, SourceLocation NoexceptLoc,
7088  concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement);
7094  BuildNestedRequirement(StringRef InvalidConstraintEntity,
7095  const ASTConstraintSatisfaction &Satisfaction);
7097  RequiresExprBodyDecl *Body,
7098  SourceLocation LParenLoc,
7099  ArrayRef<ParmVarDecl *> LocalParameters,
7100  SourceLocation RParenLoc,
7101  ArrayRef<concepts::Requirement *> Requirements,
7102  SourceLocation ClosingBraceLoc);
7103 
7104 private:
7105  ExprResult BuiltinOperatorNewDeleteOverloaded(ExprResult TheCallResult,
7106  bool IsDelete);
7107 
7108  void AnalyzeDeleteExprMismatch(const CXXDeleteExpr *DE);
7109  void AnalyzeDeleteExprMismatch(FieldDecl *Field, SourceLocation DeleteLoc,
7110  bool DeleteWasArrayForm);
7111 
7112  ///@}
7113 
7114  //
7115  //
7116  // -------------------------------------------------------------------------
7117  //
7118  //
7119 
7120  /// \name Member Access Expressions
7121  /// Implementations are in SemaExprMember.cpp
7122  ///@{
7123 
7124 public:
7125  /// Check whether an expression might be an implicit class member access.
7127  bool IsAddressOfOperand);
7128 
7130  const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R,
7131  const TemplateArgumentListInfo *TemplateArgs, const Scope *S);
7132 
7133  ExprResult
7134  BuildImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
7135  LookupResult &R,
7136  const TemplateArgumentListInfo *TemplateArgs,
7137  bool IsDefiniteInstance, const Scope *S);
7138 
7140  Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OpLoc,
7141  const CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
7142  NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo,
7143  const TemplateArgumentListInfo *TemplateArgs);
7144 
7146  tok::TokenKind OpKind, CXXScopeSpec &SS,
7147  SourceLocation TemplateKWLoc,
7148  UnqualifiedId &Member, Decl *ObjCImpDecl);
7149 
7151  Expr *Base, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec *SS,
7152  SourceLocation TemplateKWLoc, ValueDecl *Member, DeclAccessPair FoundDecl,
7153  bool HadMultipleCandidates, const DeclarationNameInfo &MemberNameInfo,
7155  const TemplateArgumentListInfo *TemplateArgs = nullptr);
7156  MemberExpr *
7157  BuildMemberExpr(Expr *Base, bool IsArrow, SourceLocation OpLoc,
7158  NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc,
7159  ValueDecl *Member, DeclAccessPair FoundDecl,
7160  bool HadMultipleCandidates,
7161  const DeclarationNameInfo &MemberNameInfo, QualType Ty,
7163  const TemplateArgumentListInfo *TemplateArgs = nullptr);
7164 
7165  bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType,
7166  const CXXScopeSpec &SS,
7167  const LookupResult &R);
7168 
7169  // This struct is for use by ActOnMemberAccess to allow
7170  // BuildMemberReferenceExpr to be able to reinvoke ActOnMemberAccess after
7171  // changing the access operator from a '.' to a '->' (to see if that is the
7172  // change needed to fix an error about an unknown member, e.g. when the class
7173  // defines a custom operator->).
7178  };
7179 
7181  Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow,
7182  CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
7183  NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo,
7184  const TemplateArgumentListInfo *TemplateArgs, const Scope *S,
7185  ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
7186 
7187  ExprResult
7189  bool IsArrow, const CXXScopeSpec &SS,
7190  SourceLocation TemplateKWLoc,
7191  NamedDecl *FirstQualifierInScope, LookupResult &R,
7192  const TemplateArgumentListInfo *TemplateArgs,
7193  const Scope *S, bool SuppressQualifierCheck = false,
7194  ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
7195 
7196  ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow,
7197  SourceLocation OpLoc,
7198  const CXXScopeSpec &SS, FieldDecl *Field,
7199  DeclAccessPair FoundDecl,
7200  const DeclarationNameInfo &MemberNameInfo);
7201 
7203 
7205  const CXXScopeSpec &SS, SourceLocation nameLoc,
7206  IndirectFieldDecl *indirectField,
7207  DeclAccessPair FoundDecl = DeclAccessPair::make(nullptr, AS_none),
7208  Expr *baseObjectExpr = nullptr, SourceLocation opLoc = SourceLocation());
7209 
7210 private:
7211  void CheckMemberAccessOfNoDeref(const MemberExpr *E);
7212 
7213  ///@}
7214 
7215  //
7216  //
7217  // -------------------------------------------------------------------------
7218  //
7219  //
7220 
7221  /// \name Initializers
7222  /// Implementations are in SemaInit.cpp
7223  ///@{
7224 
7225 public:
7226  /// Stack of types that correspond to the parameter entities that are
7227  /// currently being copy-initialized. Can be empty.
7229 
7230  llvm::DenseMap<unsigned, CXXDeductionGuideDecl *>
7232 
7233  bool IsStringInit(Expr *Init, const ArrayType *AT);
7234 
7236  const InitializedEntity &Entity, InitListExpr *From);
7237 
7239  SourceLocation EqualOrColonLoc,
7240  bool GNUSyntax, ExprResult Init);
7241 
7242  /// Check that the lifetime of the initializer (and its subobjects) is
7243  /// sufficient for initializing the entity, and perform lifetime extension
7244  /// (when permitted) if not.
7245  void checkInitializerLifetime(const InitializedEntity &Entity, Expr *Init);
7246 
7249  bool BoundToLvalueReference);
7250 
7251  /// If \p E is a prvalue denoting an unmaterialized temporary, materialize
7252  /// it as an xvalue. In C++98, the result will still be a prvalue, because
7253  /// we don't have xvalues there.
7255 
7257  Expr *E, QualType Ty, ExprValueKind VK = VK_PRValue,
7259 
7261  ExprResult Init);
7263  SourceLocation EqualLoc, ExprResult Init,
7264  bool TopLevelOfInitList = false,
7265  bool AllowExplicit = false);
7266 
7268  TypeSourceInfo *TInfo, const InitializedEntity &Entity,
7269  const InitializationKind &Kind, MultiExprArg Init);
7270 
7271  ///@}
7272 
7273  //
7274  //
7275  // -------------------------------------------------------------------------
7276  //
7277  //
7278 
7279  /// \name C++ Lambda Expressions
7280  /// Implementations are in SemaLambda.cpp
7281  ///@{
7282 
7283 public:
7284  /// Create a new lambda closure type.
7286  TypeSourceInfo *Info,
7287  unsigned LambdaDependencyKind,
7288  LambdaCaptureDefault CaptureDefault);
7289 
7290  /// Number lambda for linkage purposes if necessary.
7291  void handleLambdaNumbering(CXXRecordDecl *Class, CXXMethodDecl *Method,
7292  std::optional<CXXRecordDecl::LambdaNumbering>
7293  NumberingOverride = std::nullopt);
7294 
7295  /// Endow the lambda scope info with the relevant properties.
7296  void buildLambdaScope(sema::LambdaScopeInfo *LSI, CXXMethodDecl *CallOperator,
7297  SourceRange IntroducerRange,
7298  LambdaCaptureDefault CaptureDefault,
7299  SourceLocation CaptureDefaultLoc, bool ExplicitParams,
7300  bool Mutable);
7301 
7303  CXXRecordDecl *Class);
7304 
7306  CXXMethodDecl *CallOperator, CXXRecordDecl *Class,
7307  TemplateParameterList *TemplateParams);
7308 
7310  CXXMethodDecl *Method, SourceLocation LambdaLoc,
7311  SourceLocation CallOperatorLoc, Expr *TrailingRequiresClause,
7312  TypeSourceInfo *MethodTyInfo, ConstexprSpecKind ConstexprKind,
7314  bool HasExplicitResultType);
7315 
7317 
7318  /// Perform initialization analysis of the init-capture and perform
7319  /// any implicit conversions such as an lvalue-to-rvalue conversion if
7320  /// not being used to initialize a reference.
7322  SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc,
7323  IdentifierInfo *Id, LambdaCaptureInitKind InitKind, Expr *&Init) {
7325  Loc, ByRef, EllipsisLoc, std::nullopt, Id,
7326  InitKind != LambdaCaptureInitKind::CopyInit, Init));
7327  }
7329  SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc,
7330  std::optional<unsigned> NumExpansions, IdentifierInfo *Id,
7331  bool DirectInit, Expr *&Init);
7332 
7333  /// Create a dummy variable within the declcontext of the lambda's
7334  /// call operator, for name lookup purposes for a lambda init capture.
7335  ///
7336  /// CodeGen handles emission of lambda captures, ignoring these dummy
7337  /// variables appropriately.
7339  SourceLocation Loc, QualType InitCaptureType, SourceLocation EllipsisLoc,
7340  IdentifierInfo *Id, unsigned InitStyle, Expr *Init, DeclContext *DeclCtx);
7341 
7342  /// Add an init-capture to a lambda scope.
7343  void addInitCapture(sema::LambdaScopeInfo *LSI, VarDecl *Var, bool ByRef);
7344 
7345  /// Note that we have finished the explicit captures for the
7346  /// given lambda.
7348 
7349  /// Deduce a block or lambda's return type based on the return
7350  /// statements present in the body.
7352 
7353  /// Once the Lambdas capture are known, we can start to create the closure,
7354  /// call operator method, and keep track of the captures.
7355  /// We do the capture lookup here, but they are not actually captured until
7356  /// after we know what the qualifiers of the call operator are.
7358  Scope *CurContext);
7359 
7360  /// This is called after parsing the explicit template parameter list
7361  /// on a lambda (if it exists) in C++2a.
7363  SourceLocation LAngleLoc,
7364  ArrayRef<NamedDecl *> TParams,
7365  SourceLocation RAngleLoc,
7366  ExprResult RequiresClause);
7367 
7369  SourceLocation MutableLoc);
7370 
7372  Scope *LambdaScope,
7374 
7375  /// ActOnStartOfLambdaDefinition - This is called just before we start
7376  /// parsing the body of a lambda; it analyzes the explicit captures and
7377  /// arguments, and sets up various data-structures for the body of the
7378  /// lambda.
7380  Declarator &ParamInfo, const DeclSpec &DS);
7381 
7382  /// ActOnLambdaError - If there is an error parsing a lambda, this callback
7383  /// is invoked to pop the information about the lambda.
7384  void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope,
7385  bool IsInstantiation = false);
7386 
7387  /// ActOnLambdaExpr - This is called when the body of a lambda expression
7388  /// was successfully completed.
7389  ExprResult ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body);
7390 
7391  /// Does copying/destroying the captured variable have side effects?
7392  bool CaptureHasSideEffects(const sema::Capture &From);
7393 
7394  /// Diagnose if an explicit lambda capture is unused. Returns true if a
7395  /// diagnostic is emitted.
7396  bool DiagnoseUnusedLambdaCapture(SourceRange CaptureRange,
7397  const sema::Capture &From);
7398 
7399  /// Build a FieldDecl suitable to hold the given capture.
7401 
7402  /// Initialize the given capture with a suitable expression.
7404  SourceLocation ImplicitCaptureLoc,
7405  bool IsOpenMPMapping = false);
7406 
7407  /// Complete a lambda-expression having processed and attached the
7408  /// lambda body.
7410  sema::LambdaScopeInfo *LSI);
7411 
7412  /// Get the return type to use for a lambda's conversion function(s) to
7413  /// function pointer type, given the type of the call operator.
7414  QualType
7416  CallingConv CC);
7417 
7419  SourceLocation ConvLocation,
7420  CXXConversionDecl *Conv, Expr *Src);
7421 
7423  : private FunctionScopeRAII {
7424  public:
7426  Sema &SemasRef, FunctionDecl *FD, MultiLevelTemplateArgumentList MLTAL,
7428  bool ShouldAddDeclsFromParentScope = true);
7429  };
7430 
7431  /// Compute the mangling number context for a lambda expression or
7432  /// block literal. Also return the extra mangling decl if any.
7433  ///
7434  /// \param DC - The DeclContext containing the lambda expression or
7435  /// block literal.
7436  std::tuple<MangleNumberingContext *, Decl *>
7438 
7439  ///@}
7440 
7441  //
7442  //
7443  // -------------------------------------------------------------------------
7444  //
7445  //
7446 
7447  /// \name Name Lookup
7448  ///
7449  /// These routines provide name lookup that is used during semantic
7450  /// analysis to resolve the various kinds of names (identifiers,
7451  /// overloaded operator names, constructor names, etc.) into zero or
7452  /// more declarations within a particular scope. The major entry
7453  /// points are LookupName, which performs unqualified name lookup,
7454  /// and LookupQualifiedName, which performs qualified name lookup.
7455  ///
7456  /// All name lookup is performed based on some specific criteria,
7457  /// which specify what names will be visible to name lookup and how
7458  /// far name lookup should work. These criteria are important both
7459  /// for capturing language semantics (certain lookups will ignore
7460  /// certain names, for example) and for performance, since name
7461  /// lookup is often a bottleneck in the compilation of C++. Name
7462  /// lookup criteria is specified via the LookupCriteria enumeration.
7463  ///
7464  /// The results of name lookup can vary based on the kind of name
7465  /// lookup performed, the current language, and the translation
7466  /// unit. In C, for example, name lookup will either return nothing
7467  /// (no entity found) or a single declaration. In C++, name lookup
7468  /// can additionally refer to a set of overloaded functions or
7469  /// result in an ambiguity. All of the possible results of name
7470  /// lookup are captured by the LookupResult class, which provides
7471  /// the ability to distinguish among them.
7472  ///
7473  /// Implementations are in SemaLookup.cpp
7474  ///@{
7475 
7476 public:
7477  /// Tracks whether we are in a context where typo correction is
7478  /// disabled.
7480 
7481  /// The number of typos corrected by CorrectTypo.
7482  unsigned TyposCorrected;
7483 
7484  typedef llvm::SmallSet<SourceLocation, 2> SrcLocSet;
7485  typedef llvm::DenseMap<IdentifierInfo *, SrcLocSet> IdentifierSourceLocations;
7486 
7487  /// A cache containing identifiers for which typo correction failed and
7488  /// their locations, so that repeated attempts to correct an identifier in a
7489  /// given location are ignored if typo correction already failed for it.
7491 
7492  /// SpecialMemberOverloadResult - The overloading result for a special member
7493  /// function.
7494  ///
7495  /// This is basically a wrapper around PointerIntPair. The lowest bits of the
7496  /// integer are used to determine whether overload resolution succeeded.
7498  public:
7499  enum Kind { NoMemberOrDeleted, Ambiguous, Success };
7500 
7501  private:
7502  llvm::PointerIntPair<CXXMethodDecl *, 2> Pair;
7503 
7504  public:
7507  : Pair(MD, MD->isDeleted() ? NoMemberOrDeleted : Success) {}
7508 
7509  CXXMethodDecl *getMethod() const { return Pair.getPointer(); }
7510  void setMethod(CXXMethodDecl *MD) { Pair.setPointer(MD); }
7511 
7512  Kind getKind() const { return static_cast<Kind>(Pair.getInt()); }
7513  void setKind(Kind K) { Pair.setInt(K); }
7514  };
7515 
7516  class SpecialMemberOverloadResultEntry : public llvm::FastFoldingSetNode,
7518  public:
7519  SpecialMemberOverloadResultEntry(const llvm::FoldingSetNodeID &ID)
7520  : FastFoldingSetNode(ID) {}
7521  };
7522 
7523  /// A cache of special member function overload resolution results
7524  /// for C++ records.
7525  llvm::FoldingSet<SpecialMemberOverloadResultEntry> SpecialMemberCache;
7526 
7527  /// Holds TypoExprs that are created from `createDelayedTypo`. This is used by
7528  /// `TransformTypos` in order to keep track of any TypoExprs that are created
7529  /// recursively during typo correction and wipe them away if the correction
7530  /// fails.
7532 
7533  enum class AcceptableKind { Visible, Reachable };
7534 
7535  // Members have to be NamespaceDecl* or TranslationUnitDecl*.
7536  // TODO: make this is a typesafe union.
7539 
7540  /// Describes the kind of name lookup to perform.
7542  /// Ordinary name lookup, which finds ordinary names (functions,
7543  /// variables, typedefs, etc.) in C and most kinds of names
7544  /// (functions, variables, members, types, etc.) in C++.
7546  /// Tag name lookup, which finds the names of enums, classes,
7547  /// structs, and unions.
7549  /// Label name lookup.
7551  /// Member name lookup, which finds the names of
7552  /// class/struct/union members.
7554  /// Look up of an operator name (e.g., operator+) for use with
7555  /// operator overloading. This lookup is similar to ordinary name
7556  /// lookup, but will ignore any declarations that are class members.
7558  /// Look up a name following ~ in a destructor name. This is an ordinary
7559  /// lookup, but prefers tags to typedefs.
7561  /// Look up of a name that precedes the '::' scope resolution
7562  /// operator in C++. This lookup completely ignores operator, object,
7563  /// function, and enumerator names (C++ [basic.lookup.qual]p1).
7565  /// Look up a namespace name within a C++ using directive or
7566  /// namespace alias definition, ignoring non-namespace names (C++
7567  /// [basic.lookup.udir]p1).
7569  /// Look up all declarations in a scope with the given name,
7570  /// including resolved using declarations. This is appropriate
7571  /// for checking redeclarations for a using declaration.
7573  /// Look up an ordinary name that is going to be redeclared as a
7574  /// name with linkage. This lookup ignores any declarations that
7575  /// are outside of the current scope unless they have linkage. See
7576  /// C99 6.2.2p4-5 and C++ [basic.link]p6.
7578  /// Look up a friend of a local class. This lookup does not look
7579  /// outside the innermost non-class scope. See C++11 [class.friend]p11.
7581  /// Look up the name of an Objective-C protocol.
7583  /// Look up implicit 'self' parameter of an objective-c method.
7585  /// Look up the name of an OpenMP user-defined reduction operation.
7587  /// Look up the name of an OpenMP user-defined mapper.
7589  /// Look up any declaration with any name.
7591  };
7592 
7593  /// The possible outcomes of name lookup for a literal operator.
7595  /// The lookup resulted in an error.
7597  /// The lookup found no match but no diagnostic was issued.
7599  /// The lookup found a single 'cooked' literal operator, which
7600  /// expects a normal literal to be built and passed to it.
7602  /// The lookup found a single 'raw' literal operator, which expects
7603  /// a string literal containing the spelling of the literal token.
7605  /// The lookup found an overload set of literal operator templates,
7606  /// which expect the characters of the spelling of the literal token to be
7607  /// passed as a non-type template argument pack.
7609  /// The lookup found an overload set of literal operator templates,
7610  /// which expect the character type and characters of the spelling of the
7611  /// string literal token to be passed as template arguments.
7613  };
7614 
7615  SpecialMemberOverloadResult
7617  bool VolatileArg, bool RValueThis, bool ConstThis,
7618  bool VolatileThis);
7619 
7620  typedef std::function<void(const TypoCorrection &)> TypoDiagnosticGenerator;
7621  typedef std::function<ExprResult(Sema &, TypoExpr *, TypoCorrection)>
7623 
7625 
7626  /// Look up a name, looking for a single declaration. Return
7627  /// null if the results were absent, ambiguous, or overloaded.
7628  ///
7629  /// It is preferable to use the elaborated form and explicitly handle
7630  /// ambiguity and overloaded.
7632  Scope *S, DeclarationName Name, SourceLocation Loc,
7633  LookupNameKind NameKind,
7635  bool LookupBuiltin(LookupResult &R);
7636  void LookupNecessaryTypesForBuiltin(Scope *S, unsigned ID);
7637  bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation = false,
7638  bool ForceNoCPlusPlus = false);
7639  bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
7640  bool InUnqualifiedLookup = false);
7641  bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
7642  CXXScopeSpec &SS);
7644  bool AllowBuiltinCreation = false,
7645  bool EnteringContext = false);
7647  IdentifierInfo *II, SourceLocation IdLoc,
7649  bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class);
7650 
7652  UnresolvedSetImpl &Functions);
7653 
7655  SourceLocation GnuLabelLoc = SourceLocation());
7656 
7660  unsigned Quals);
7661  CXXMethodDecl *LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals,
7662  bool RValueThis, unsigned ThisQuals);
7664  unsigned Quals);
7665  CXXMethodDecl *LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals,
7666  bool RValueThis, unsigned ThisQuals);
7668 
7669  /// Force the declaration of any implicitly-declared members of this
7670  /// class.
7672 
7673  /// Make a merged definition of an existing hidden definition \p ND
7674  /// visible at the specified location.
7676 
7677  /// Get the set of additional modules that should be checked during
7678  /// name lookup. A module and its imports become visible when instanting a
7679  /// template defined within it.
7681 
7682  bool hasVisibleMergedDefinition(const NamedDecl *Def);
7684 
7685  /// Determine if the template parameter \p D has a visible default argument.
7686  bool
7688  llvm::SmallVectorImpl<Module *> *Modules = nullptr);
7689  /// Determine if the template parameter \p D has a reachable default argument.
7691  const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
7692  /// Determine if the template parameter \p D has a reachable default argument.
7696 
7697  /// Determine if there is a visible declaration of \p D that is an explicit
7698  /// specialization declaration for a specialization of a template. (For a
7699  /// member specialization, use hasVisibleMemberSpecialization.)
7701  const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
7702  /// Determine if there is a reachable declaration of \p D that is an explicit
7703  /// specialization declaration for a specialization of a template. (For a
7704  /// member specialization, use hasReachableMemberSpecialization.)
7706  const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
7707 
7708  /// Determine if there is a visible declaration of \p D that is a member
7709  /// specialization declaration (as opposed to an instantiated declaration).
7711  const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
7712  /// Determine if there is a reachable declaration of \p D that is a member
7713  /// specialization declaration (as opposed to an instantiated declaration).
7715  const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
7716 
7717  bool isModuleVisible(const Module *M, bool ModulePrivate = false);
7718 
7719  /// Determine whether any declaration of an entity is visible.
7720  bool
7722  llvm::SmallVectorImpl<Module *> *Modules = nullptr) {
7723  return isVisible(D) || hasVisibleDeclarationSlow(D, Modules);
7724  }
7725 
7726  bool hasVisibleDeclarationSlow(const NamedDecl *D,
7728  /// Determine whether any declaration of an entity is reachable.
7729  bool
7731  llvm::SmallVectorImpl<Module *> *Modules = nullptr) {
7732  return isReachable(D) || hasReachableDeclarationSlow(D, Modules);
7733  }
7735  const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
7736 
7737  void diagnoseTypo(const TypoCorrection &Correction,
7738  const PartialDiagnostic &TypoDiag,
7739  bool ErrorRecovery = true);
7740 
7741  void diagnoseTypo(const TypoCorrection &Correction,
7742  const PartialDiagnostic &TypoDiag,
7743  const PartialDiagnostic &PrevNote,
7744  bool ErrorRecovery = true);
7745 
7747  SourceLocation InstantiationLoc, ArrayRef<Expr *> Args,
7748  AssociatedNamespaceSet &AssociatedNamespaces,
7749  AssociatedClassSet &AssociatedClasses);
7750 
7751  void DiagnoseAmbiguousLookup(LookupResult &Result);
7752 
7755  bool AllowRaw, bool AllowTemplate,
7756  bool AllowStringTemplate, bool DiagnoseMissing,
7757  StringLiteral *StringLit = nullptr);
7758 
7760  ArrayRef<Expr *> Args, ADLResult &Functions);
7761 
7764  bool IncludeGlobalScope = true,
7765  bool LoadExternal = true);
7768  bool IncludeGlobalScope = true,
7769  bool IncludeDependentBases = false,
7770  bool LoadExternal = true);
7771 
7773  CTK_NonError, // CorrectTypo used in a non error recovery situation.
7774  CTK_ErrorRecovery // CorrectTypo used in normal error recovery.
7775  };
7776 
7778  Sema::LookupNameKind LookupKind, Scope *S,
7780  CorrectTypoKind Mode,
7781  DeclContext *MemberContext = nullptr,
7782  bool EnteringContext = false,
7783  const ObjCObjectPointerType *OPT = nullptr,
7784  bool RecordFailure = true);
7785 
7787  const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind,
7790  CorrectTypoKind Mode, DeclContext *MemberContext = nullptr,
7791  bool EnteringContext = false, const ObjCObjectPointerType *OPT = nullptr);
7792 
7793  /// Kinds of missing import. Note, the values of these enumerators correspond
7794  /// to %select values in diagnostics.
7795  enum class MissingImportKind {
7796  Declaration,
7797  Definition,
7798  DefaultArgument,
7799  ExplicitSpecialization,
7800  PartialSpecialization
7801  };
7802 
7803  /// Diagnose that the specified declaration needs to be visible but
7804  /// isn't, and suggest a module import that would resolve the problem.
7806  MissingImportKind MIK, bool Recover = true);
7808  SourceLocation DeclLoc, ArrayRef<Module *> Modules,
7809  MissingImportKind MIK, bool Recover);
7810 
7811  struct TypoExprState {
7812  std::unique_ptr<TypoCorrectionConsumer> Consumer;
7815  TypoExprState();
7816  TypoExprState(TypoExprState &&other) noexcept;
7817  TypoExprState &operator=(TypoExprState &&other) noexcept;
7818  };
7819 
7820  const TypoExprState &getTypoExprState(TypoExpr *TE) const;
7821 
7822  /// Clears the state of the given TypoExpr.
7823  void clearDelayedTypo(TypoExpr *TE);
7824 
7825  /// Called on #pragma clang __debug dump II
7827 
7828  /// Called on #pragma clang __debug dump E
7829  void ActOnPragmaDump(Expr *E);
7830 
7831 private:
7832  // The set of known/encountered (unique, canonicalized) NamespaceDecls.
7833  //
7834  // The boolean value will be true to indicate that the namespace was loaded
7835  // from an AST/PCH file, or false otherwise.
7836  llvm::MapVector<NamespaceDecl *, bool> KnownNamespaces;
7837 
7838  /// Whether we have already loaded known namespaces from an extenal
7839  /// source.
7840  bool LoadedExternalKnownNamespaces;
7841 
7842  bool CppLookupName(LookupResult &R, Scope *S);
7843 
7844  bool isUsableModule(const Module *M);
7845 
7846  /// Helper for CorrectTypo and CorrectTypoDelayed used to create and
7847  /// populate a new TypoCorrectionConsumer. Returns nullptr if typo correction
7848  /// should be skipped entirely.
7849  std::unique_ptr<TypoCorrectionConsumer> makeTypoCorrectionConsumer(
7850  const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind,
7852  DeclContext *MemberContext, bool EnteringContext,
7853  const ObjCObjectPointerType *OPT, bool ErrorRecovery);
7854 
7855  /// The set of unhandled TypoExprs and their associated state.
7856  llvm::MapVector<TypoExpr *, TypoExprState> DelayedTypos;
7857 
7858  /// Creates a new TypoExpr AST node.
7859  TypoExpr *createDelayedTypo(std::unique_ptr<TypoCorrectionConsumer> TCC,
7861  TypoRecoveryCallback TRC, SourceLocation TypoLoc);
7862 
7863  /// Cache for module units which is usable for current module.
7864  llvm::DenseSet<const Module *> UsableModuleUnitsCache;
7865 
7866  /// Record the typo correction failure and return an empty correction.
7867  TypoCorrection FailedCorrection(IdentifierInfo *Typo, SourceLocation TypoLoc,
7868  bool RecordFailure = true) {
7869  if (RecordFailure)
7870  TypoCorrectionFailures[Typo].insert(TypoLoc);
7871  return TypoCorrection();
7872  }
7873 
7874  bool isAcceptableSlow(const NamedDecl *D, AcceptableKind Kind);
7875 
7876  /// Determine whether two declarations should be linked together, given that
7877  /// the old declaration might not be visible and the new declaration might
7878  /// not have external linkage.
7879  bool shouldLinkPossiblyHiddenDecl(const NamedDecl *Old,
7880  const NamedDecl *New) {
7881  if (isVisible(Old))
7882  return true;
7883  // See comment in below overload for why it's safe to compute the linkage
7884  // of the new declaration here.
7885  if (New->isExternallyDeclarable()) {
7886  assert(Old->isExternallyDeclarable() &&
7887  "should not have found a non-externally-declarable previous decl");
7888  return true;
7889  }
7890  return false;
7891  }
7892  bool shouldLinkPossiblyHiddenDecl(LookupResult &Old, const NamedDecl *New);
7893 
7894  ///@}
7895 
7896  //
7897  //
7898  // -------------------------------------------------------------------------
7899  //
7900  //
7901 
7902  /// \name Modules
7903  /// Implementations are in SemaModule.cpp
7904  ///@{
7905 
7906 public:
7907  /// Get the module unit whose scope we are currently within.
7909  return ModuleScopes.empty() ? nullptr : ModuleScopes.back().Module;
7910  }
7911 
7912  /// Is the module scope we are an implementation unit?
7914  return ModuleScopes.empty()
7915  ? false
7916  : ModuleScopes.back().Module->isModuleImplementation();
7917  }
7918 
7919  // When loading a non-modular PCH files, this is used to restore module
7920  // visibility.
7921  void makeModuleVisible(Module *Mod, SourceLocation ImportLoc) {
7922  VisibleModules.setVisible(Mod, ImportLoc);
7923  }
7924 
7925  enum class ModuleDeclKind {
7926  Interface, ///< 'export module X;'
7927  Implementation, ///< 'module X;'
7928  PartitionInterface, ///< 'export module X:Y;'
7929  PartitionImplementation, ///< 'module X:Y;'
7930  };
7931 
7932  /// An enumeration to represent the transition of states in parsing module
7933  /// fragments and imports. If we are not parsing a C++20 TU, or we find
7934  /// an error in state transition, the state is set to NotACXX20Module.
7935  enum class ModuleImportState {
7936  FirstDecl, ///< Parsing the first decl in a TU.
7937  GlobalFragment, ///< after 'module;' but before 'module X;'
7938  ImportAllowed, ///< after 'module X;' but before any non-import decl.
7939  ImportFinished, ///< after any non-import decl.
7940  PrivateFragmentImportAllowed, ///< after 'module :private;' but before any
7941  ///< non-import decl.
7942  PrivateFragmentImportFinished, ///< after 'module :private;' but a
7943  ///< non-import decl has already been seen.
7944  NotACXX20Module ///< Not a C++20 TU, or an invalid state was found.
7945  };
7946 
7947  /// The parser has processed a module-declaration that begins the definition
7948  /// of a module interface or implementation.
7950  SourceLocation ModuleLoc, ModuleDeclKind MDK,
7951  ModuleIdPath Path, ModuleIdPath Partition,
7952  ModuleImportState &ImportState);
7953 
7954  /// The parser has processed a global-module-fragment declaration that begins
7955  /// the definition of the global module fragment of the current module unit.
7956  /// \param ModuleLoc The location of the 'module' keyword.
7958 
7959  /// The parser has processed a private-module-fragment declaration that begins
7960  /// the definition of the private module fragment of the current module unit.
7961  /// \param ModuleLoc The location of the 'module' keyword.
7962  /// \param PrivateLoc The location of the 'private' keyword.
7964  SourceLocation PrivateLoc);
7965 
7966  /// The parser has processed a module import declaration.
7967  ///
7968  /// \param StartLoc The location of the first token in the declaration. This
7969  /// could be the location of an '@', 'export', or 'import'.
7970  /// \param ExportLoc The location of the 'export' keyword, if any.
7971  /// \param ImportLoc The location of the 'import' keyword.
7972  /// \param Path The module toplevel name as an access path.
7973  /// \param IsPartition If the name is for a partition.
7975  SourceLocation ExportLoc,
7976  SourceLocation ImportLoc, ModuleIdPath Path,
7977  bool IsPartition = false);
7979  SourceLocation ExportLoc,
7980  SourceLocation ImportLoc, Module *M,
7981  ModuleIdPath Path = {});
7982 
7983  /// The parser has processed a module import translated from a
7984  /// #include or similar preprocessing directive.
7985  void ActOnAnnotModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
7986  void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
7987 
7988  /// The parsed has entered a submodule.
7989  void ActOnAnnotModuleBegin(SourceLocation DirectiveLoc, Module *Mod);
7990  /// The parser has left a submodule.
7991  void ActOnAnnotModuleEnd(SourceLocation DirectiveLoc, Module *Mod);
7992 
7993  /// Create an implicit import of the given module at the given
7994  /// source location, for error recovery, if possible.
7995  ///
7996  /// This routine is typically used when an entity found by name lookup
7997  /// is actually hidden within a module that we know about but the user
7998  /// has forgotten to import.
7999  void createImplicitModuleImportForErrorRecovery(SourceLocation Loc,
8000  Module *Mod);
8001 
8002  Decl *ActOnStartExportDecl(Scope *S, SourceLocation ExportLoc,
8003  SourceLocation LBraceLoc);
8004  Decl *ActOnFinishExportDecl(Scope *S, Decl *ExportDecl,
8005  SourceLocation RBraceLoc);
8006 
8007 private:
8008  /// The parser has begun a translation unit to be compiled as a C++20
8009  /// Header Unit, helper for ActOnStartOfTranslationUnit() only.
8010  void HandleStartOfHeaderUnit();
8011 
8012  struct ModuleScope {
8013  SourceLocation BeginLoc;
8014  clang::Module *Module = nullptr;
8015  VisibleModuleSet OuterVisibleModules;
8016  };
8017  /// The modules we're currently parsing.
8019 
8020  /// For an interface unit, this is the implicitly imported interface unit.
8021  clang::Module *ThePrimaryInterface = nullptr;
8022 
8023  /// The explicit global module fragment of the current translation unit.
8024  /// The explicit Global Module Fragment, as specified in C++
8025  /// [module.global.frag].
8026  clang::Module *TheGlobalModuleFragment = nullptr;
8027 
8028  /// The implicit global module fragments of the current translation unit.
8029  ///
8030  /// The contents in the implicit global module fragment can't be discarded.
8031  clang::Module *TheImplicitGlobalModuleFragment = nullptr;
8032 
8033  /// Namespace definitions that we will export when they finish.
8034  llvm::SmallPtrSet<const NamespaceDecl *, 8> DeferredExportedNamespaces;
8035 
8036  /// In a C++ standard module, inline declarations require a definition to be
8037  /// present at the end of a definition domain. This set holds the decls to
8038  /// be checked at the end of the TU.
8039  llvm::SmallPtrSet<const FunctionDecl *, 8> PendingInlineFuncDecls;
8040 
8041  /// Helper function to judge if we are in module purview.
8042  /// Return false if we are not in a module.
8043  bool isCurrentModulePurview() const;
8044 
8045  /// Enter the scope of the explicit global module fragment.
8046  Module *PushGlobalModuleFragment(SourceLocation BeginLoc);
8047  /// Leave the scope of the explicit global module fragment.
8048  void PopGlobalModuleFragment();
8049 
8050  /// Enter the scope of an implicit global module fragment.
8051  Module *PushImplicitGlobalModuleFragment(SourceLocation BeginLoc);
8052  /// Leave the scope of an implicit global module fragment.
8053  void PopImplicitGlobalModuleFragment();
8054 
8055  VisibleModuleSet VisibleModules;
8056 
8057  ///@}
8058 
8059  //
8060  //
8061  // -------------------------------------------------------------------------
8062  //
8063  //
8064 
8065  /// \name C++ Overloading
8066  /// Implementations are in SemaOverload.cpp
8067  ///@{
8068 
8069 public:
8070  /// Whether deferrable diagnostics should be deferred.
8071  bool DeferDiags = false;
8072 
8073  /// RAII class to control scope of DeferDiags.
8075  Sema &S;
8076  bool SavedDeferDiags = false;
8077 
8078  public:
8080  : S(S), SavedDeferDiags(S.DeferDiags) {
8081  S.DeferDiags = DeferDiags;
8082  }
8083  ~DeferDiagsRAII() { S.DeferDiags = SavedDeferDiags; }
8084  };
8085 
8086  /// Flag indicating if Sema is building a recovery call expression.
8087  ///
8088  /// This flag is used to avoid building recovery call expressions
8089  /// if Sema is already doing so, which would cause infinite recursions.
8091 
8093  /// This is a legitimate overload: the existing declarations are
8094  /// functions or function templates with different signatures.
8096 
8097  /// This is not an overload because the signature exactly matches
8098  /// an existing declaration.
8100 
8101  /// This is not an overload because the lookup results contain a
8102  /// non-function.
8104  };
8106  const LookupResult &OldDecls, NamedDecl *&OldDecl,
8107  bool UseMemberUsingDeclRules);
8108  bool IsOverload(FunctionDecl *New, FunctionDecl *Old,
8109  bool UseMemberUsingDeclRules, bool ConsiderCudaAttrs = true);
8110 
8111  // Checks whether MD constitutes an override the base class method BaseMD.
8112  // When checking for overrides, the object object members are ignored.
8113  bool IsOverride(FunctionDecl *MD, FunctionDecl *BaseMD,
8114  bool UseMemberUsingDeclRules, bool ConsiderCudaAttrs = true);
8115 
8116  enum class AllowedExplicit {
8117  /// Allow no explicit functions to be used.
8118  None,
8119  /// Allow explicit conversion functions but not explicit constructors.
8120  Conversions,
8121  /// Allow both explicit conversion functions and explicit constructors.
8122  All
8123  };
8124 
8126  Expr *From, QualType ToType, bool SuppressUserConversions,
8127  AllowedExplicit AllowExplicit, bool InOverloadResolution, bool CStyle,
8128  bool AllowObjCWritebackConversion);
8129 
8131  AssignmentAction Action,
8132  bool AllowExplicit = false);
8133 
8134  bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
8135  bool IsFloatingPointPromotion(QualType FromType, QualType ToType);
8136  bool IsComplexPromotion(QualType FromType, QualType ToType);
8137  bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
8138  bool InOverloadResolution, QualType &ConvertedType,
8139  bool &IncompatibleObjC);
8140  bool isObjCPointerConversion(QualType FromType, QualType ToType,
8141  QualType &ConvertedType, bool &IncompatibleObjC);
8142  bool isObjCWritebackConversion(QualType FromType, QualType ToType,
8143  QualType &ConvertedType);
8144  bool IsBlockPointerConversion(QualType FromType, QualType ToType,
8145  QualType &ConvertedType);
8146 
8148  ArrayRef<QualType> New,
8149  unsigned *ArgPos = nullptr,
8150  bool Reversed = false);
8151 
8152  bool FunctionParamTypesAreEqual(const FunctionProtoType *OldType,
8153  const FunctionProtoType *NewType,
8154  unsigned *ArgPos = nullptr,
8155  bool Reversed = false);
8156 
8157  bool FunctionNonObjectParamTypesAreEqual(const FunctionDecl *OldFunction,
8158  const FunctionDecl *NewFunction,
8159  unsigned *ArgPos = nullptr,
8160  bool Reversed = false);
8161 
8163  QualType ToType);
8164 
8165  bool CheckPointerConversion(Expr *From, QualType ToType, CastKind &Kind,
8166  CXXCastPath &BasePath, bool IgnoreBaseAccess,
8167  bool Diagnose = true);
8168  bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType,
8169  bool InOverloadResolution,
8170  QualType &ConvertedType);
8172  CXXCastPath &BasePath,
8173  bool IgnoreBaseAccess);
8174  bool IsQualificationConversion(QualType FromType, QualType ToType,
8175  bool CStyle, bool &ObjCLifetimeConversion);
8176  bool IsFunctionConversion(QualType FromType, QualType ToType,
8177  QualType &ResultTy);
8180  DeclarationName Name,
8181  OverloadCandidateSet &CandidateSet,
8182  FunctionDecl *Fn, MultiExprArg Args,
8183  bool IsMember = false);
8184 
8186  FunctionDecl *Fun);
8188  Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl,
8189  CXXMethodDecl *Method);
8190 
8193 
8194  /// Contexts in which a converted constant expression is required.
8195  enum CCEKind {
8196  CCEK_CaseValue, ///< Expression in a case label.
8197  CCEK_Enumerator, ///< Enumerator value with fixed underlying type.
8198  CCEK_TemplateArg, ///< Value of a non-type template parameter.
8199  CCEK_ArrayBound, ///< Array bound in array declarator or new-expression.
8200  CCEK_ExplicitBool, ///< Condition in an explicit(bool) specifier.
8201  CCEK_Noexcept, ///< Condition in a noexcept(bool) specifier.
8202  CCEK_StaticAssertMessageSize, ///< Call to size() in a static assert
8203  ///< message.
8204  CCEK_StaticAssertMessageData, ///< Call to data() in a static assert
8205  ///< message.
8206  };
8207 
8209  CCEKind CCE,
8210  NamedDecl *Dest = nullptr);
8211 
8213  llvm::APSInt &Value, CCEKind CCE);
8215  APValue &Value, CCEKind CCE,
8216  NamedDecl *Dest = nullptr);
8217 
8218  ExprResult
8220  CCEKind CCE, bool RequireInt,
8221  const APValue &PreNarrowingValue);
8222 
8223  /// Abstract base class used to perform a contextual implicit
8224  /// conversion from an expression to any type passing a filter.
8226  public:
8227  bool Suppress;
8229 
8230  ContextualImplicitConverter(bool Suppress = false,
8231  bool SuppressConversion = false)
8232  : Suppress(Suppress), SuppressConversion(SuppressConversion) {}
8233 
8234  /// Determine whether the specified type is a valid destination type
8235  /// for this conversion.
8236  virtual bool match(QualType T) = 0;
8237 
8238  /// Emits a diagnostic complaining that the expression does not have
8239  /// integral or enumeration type.
8241  QualType T) = 0;
8242 
8243  /// Emits a diagnostic when the expression has incomplete class type.
8244  virtual SemaDiagnosticBuilder
8246 
8247  /// Emits a diagnostic when the only matching conversion function
8248  /// is explicit.
8250  SourceLocation Loc,
8251  QualType T,
8252  QualType ConvTy) = 0;
8253 
8254  /// Emits a note for the explicit conversion function.
8255  virtual SemaDiagnosticBuilder
8257 
8258  /// Emits a diagnostic when there are multiple possible conversion
8259  /// functions.
8261  QualType T) = 0;
8262 
8263  /// Emits a note for one of the candidate conversions.
8264  virtual SemaDiagnosticBuilder
8266 
8267  /// Emits a diagnostic when we picked a conversion function
8268  /// (for cases when we are not allowed to pick a conversion function).
8270  SourceLocation Loc,
8271  QualType T,
8272  QualType ConvTy) = 0;
8273 
8275  };
8276 
8278  bool AllowScopedEnumerations;
8279 
8280  public:
8281  ICEConvertDiagnoser(bool AllowScopedEnumerations, bool Suppress,
8282  bool SuppressConversion)
8283  : ContextualImplicitConverter(Suppress, SuppressConversion),
8284  AllowScopedEnumerations(AllowScopedEnumerations) {}
8285 
8286  /// Match an integral or (possibly scoped) enumeration type.
8287  bool match(QualType T) override;
8288 
8290  QualType T) override {
8291  return diagnoseNotInt(S, Loc, T);
8292  }
8293 
8294  /// Emits a diagnostic complaining that the expression does not have
8295  /// integral or enumeration type.
8297  QualType T) = 0;
8298  };
8299 
8300  /// Perform a contextual implicit conversion.
8301  ExprResult
8303  ContextualImplicitConverter &Converter);
8304 
8305  /// ReferenceCompareResult - Expresses the result of comparing two
8306  /// types (cv1 T1 and cv2 T2) to determine their compatibility for the
8307  /// purposes of initialization by reference (C++ [dcl.init.ref]p4).
8309  /// Ref_Incompatible - The two types are incompatible, so direct
8310  /// reference binding is not possible.
8312  /// Ref_Related - The two types are reference-related, which means
8313  /// that their unqualified forms (T1 and T2) are either the same
8314  /// or T1 is a base class of T2.
8316  /// Ref_Compatible - The two types are reference-compatible.
8318  };
8319 
8320  // Fake up a scoped enumeration that still contextually converts to bool.
8322  /// The conversions that would be performed on an lvalue of type T2 when
8323  /// binding a reference of type T1 to it, as determined when evaluating
8324  /// whether T1 is reference-compatible with T2.
8326  Qualification = 0x1,
8327  NestedQualification = 0x2,
8328  Function = 0x4,
8329  DerivedToBase = 0x8,
8330  ObjC = 0x10,
8331  ObjCLifetime = 0x20,
8332 
8333  LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/ObjCLifetime)
8334  };
8335  };
8337 
8340  ReferenceConversions *Conv = nullptr);
8341 
8342  void AddOverloadCandidate(
8343  FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef<Expr *> Args,
8344  OverloadCandidateSet &CandidateSet, bool SuppressUserConversions = false,
8345  bool PartialOverloading = false, bool AllowExplicit = true,
8346  bool AllowExplicitConversion = false,
8347  ADLCallKind IsADLCandidate = ADLCallKind::NotADL,
8348  ConversionSequenceList EarlyConversions = std::nullopt,
8350  bool AggregateCandidateDeduction = false);
8351  void AddFunctionCandidates(
8352  const UnresolvedSetImpl &Functions, ArrayRef<Expr *> Args,
8353  OverloadCandidateSet &CandidateSet,
8354  TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
8355  bool SuppressUserConversions = false, bool PartialOverloading = false,
8356  bool FirstArgumentIsBase = false);
8357  void AddMethodCandidate(DeclAccessPair FoundDecl, QualType ObjectType,
8358  Expr::Classification ObjectClassification,
8359  ArrayRef<Expr *> Args,
8360  OverloadCandidateSet &CandidateSet,
8361  bool SuppressUserConversion = false,
8362  OverloadCandidateParamOrder PO = {});
8363  void
8364  AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl,
8365  CXXRecordDecl *ActingContext, QualType ObjectType,
8366  Expr::Classification ObjectClassification,
8367  ArrayRef<Expr *> Args, OverloadCandidateSet &CandidateSet,
8368  bool SuppressUserConversions = false,
8369  bool PartialOverloading = false,
8370  ConversionSequenceList EarlyConversions = std::nullopt,
8371  OverloadCandidateParamOrder PO = {});
8373  FunctionTemplateDecl *MethodTmpl, DeclAccessPair FoundDecl,
8374  CXXRecordDecl *ActingContext,
8375  TemplateArgumentListInfo *ExplicitTemplateArgs, QualType ObjectType,
8376  Expr::Classification ObjectClassification, ArrayRef<Expr *> Args,
8377  OverloadCandidateSet &CandidateSet, bool SuppressUserConversions = false,
8378  bool PartialOverloading = false, OverloadCandidateParamOrder PO = {});
8380  FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
8381  TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef<Expr *> Args,
8382  OverloadCandidateSet &CandidateSet, bool SuppressUserConversions = false,
8383  bool PartialOverloading = false, bool AllowExplicit = true,
8384  ADLCallKind IsADLCandidate = ADLCallKind::NotADL,
8386  bool AggregateCandidateDeduction = false);
8388  FunctionTemplateDecl *FunctionTemplate, ArrayRef<QualType> ParamTypes,
8389  ArrayRef<Expr *> Args, OverloadCandidateSet &CandidateSet,
8390  ConversionSequenceList &Conversions, bool SuppressUserConversions,
8391  CXXRecordDecl *ActingContext = nullptr, QualType ObjectType = QualType(),
8392  Expr::Classification ObjectClassification = {},
8393  OverloadCandidateParamOrder PO = {});
8395  CXXConversionDecl *Conversion, DeclAccessPair FoundDecl,
8396  CXXRecordDecl *ActingContext, Expr *From, QualType ToType,
8397  OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit,
8398  bool AllowExplicit, bool AllowResultConversion = true);
8400  FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
8401  CXXRecordDecl *ActingContext, Expr *From, QualType ToType,
8402  OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit,
8403  bool AllowExplicit, bool AllowResultConversion = true);
8404  void AddSurrogateCandidate(CXXConversionDecl *Conversion,
8405  DeclAccessPair FoundDecl,
8406  CXXRecordDecl *ActingContext,
8407  const FunctionProtoType *Proto, Expr *Object,
8408  ArrayRef<Expr *> Args,
8409  OverloadCandidateSet &CandidateSet);
8411  const UnresolvedSetImpl &Functions, ArrayRef<Expr *> Args,
8412  OverloadCandidateSet &CandidateSet,
8413  TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
8415  SourceLocation OpLoc, ArrayRef<Expr *> Args,
8416  OverloadCandidateSet &CandidateSet,
8417  OverloadCandidateParamOrder PO = {});
8418  void AddBuiltinCandidate(QualType *ParamTys, ArrayRef<Expr *> Args,
8419  OverloadCandidateSet &CandidateSet,
8420  bool IsAssignmentOperator = false,
8421  unsigned NumContextualBoolArguments = 0);
8423  SourceLocation OpLoc, ArrayRef<Expr *> Args,
8424  OverloadCandidateSet &CandidateSet);
8426  DeclarationName Name, SourceLocation Loc, ArrayRef<Expr *> Args,
8427  TemplateArgumentListInfo *ExplicitTemplateArgs,
8428  OverloadCandidateSet &CandidateSet, bool PartialOverloading = false);
8429 
8430  /// Check the enable_if expressions on the given function. Returns the first
8431  /// failing attribute, or NULL if they were all successful.
8432  EnableIfAttr *CheckEnableIf(FunctionDecl *Function, SourceLocation CallLoc,
8433  ArrayRef<Expr *> Args,
8434  bool MissingImplicitThis = false);
8435 
8436  /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
8437  /// non-ArgDependent DiagnoseIfAttrs.
8438  ///
8439  /// Argument-dependent diagnose_if attributes should be checked each time a
8440  /// function is used as a direct callee of a function call.
8441  ///
8442  /// Returns true if any errors were emitted.
8443  bool diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function,
8444  const Expr *ThisArg,
8445  ArrayRef<const Expr *> Args,
8446  SourceLocation Loc);
8447 
8448  /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
8449  /// ArgDependent DiagnoseIfAttrs.
8450  ///
8451  /// Argument-independent diagnose_if attributes should be checked on every use
8452  /// of a function.
8453  ///
8454  /// Returns true if any errors were emitted.
8455  bool diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND,
8456  SourceLocation Loc);
8457 
8458  /// Determine if \p A and \p B are equivalent internal linkage declarations
8459  /// from different modules, and thus an ambiguity error can be downgraded to
8460  /// an extension warning.
8461  bool isEquivalentInternalLinkageDeclaration(const NamedDecl *A,
8462  const NamedDecl *B);
8464  SourceLocation Loc, const NamedDecl *D,
8465  ArrayRef<const NamedDecl *> Equiv);
8466 
8467  // Emit as a 'note' the specific overload candidate
8468  void NoteOverloadCandidate(
8469  const NamedDecl *Found, const FunctionDecl *Fn,
8471  QualType DestType = QualType(), bool TakingAddress = false);
8472 
8473  // Emit as a series of 'note's all template and non-templates identified by
8474  // the expression Expr
8475  void NoteAllOverloadCandidates(Expr *E, QualType DestType = QualType(),
8476  bool TakingAddress = false);
8477 
8478  /// Returns whether the given function's address can be taken or not,
8479  /// optionally emitting a diagnostic if the address can't be taken.
8480  ///
8481  /// Returns false if taking the address of the function is illegal.
8482  bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function,
8483  bool Complain = false,
8484  SourceLocation Loc = SourceLocation());
8485 
8486  // [PossiblyAFunctionType] --> [Return]
8487  // NonFunctionType --> NonFunctionType
8488  // R (A) --> R(A)
8489  // R (*)(A) --> R (A)
8490  // R (&)(A) --> R (A)
8491  // R (S::*)(A) --> R (A)
8492  QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType);
8493 
8494  FunctionDecl *
8495  ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, QualType TargetType,
8496  bool Complain, DeclAccessPair &Found,
8497  bool *pHadMultipleCandidates = nullptr);
8498 
8499  FunctionDecl *
8500  resolveAddressOfSingleOverloadCandidate(Expr *E, DeclAccessPair &FoundResult);
8501 
8503  ExprResult &SrcExpr, bool DoFunctionPointerConversion = false);
8504 
8506  OverloadExpr *ovl, bool Complain = false, DeclAccessPair *Found = nullptr,
8507  TemplateSpecCandidateSet *FailedTSC = nullptr);
8508 
8510  ExprResult &SrcExpr, bool DoFunctionPointerConversion = false,
8511  bool Complain = false, SourceRange OpRangeForComplaining = SourceRange(),
8512  QualType DestTypeForComplaining = QualType(),
8513  unsigned DiagIDForComplaining = 0);
8514 
8515  void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE,
8516  ArrayRef<Expr *> Args,
8517  OverloadCandidateSet &CandidateSet,
8518  bool PartialOverloading = false);
8520  LookupResult &R, TemplateArgumentListInfo *ExplicitTemplateArgs,
8521  ArrayRef<Expr *> Args, OverloadCandidateSet &CandidateSet);
8522 
8523  // An enum used to represent the different possible results of building a
8524  // range-based for loop.
8529  };
8530 
8532  SourceLocation RangeLoc,
8533  const DeclarationNameInfo &NameInfo,
8534  LookupResult &MemberLookup,
8535  OverloadCandidateSet *CandidateSet,
8536  Expr *Range, ExprResult *CallExpr);
8537 
8539  Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, SourceLocation LParenLoc,
8540  MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig,
8541  bool AllowTypoCorrection = true, bool CalleesAddressIsTaken = false);
8542 
8544  MultiExprArg Args, SourceLocation RParenLoc,
8545  OverloadCandidateSet *CandidateSet,
8546  ExprResult *Result);
8547 
8549  NestedNameSpecifierLoc NNSLoc,
8550  DeclarationNameInfo DNI,
8551  const UnresolvedSetImpl &Fns,
8552  bool PerformADL = true);
8553 
8555  UnaryOperatorKind Opc,
8556  const UnresolvedSetImpl &Fns, Expr *input,
8557  bool RequiresADL = true);
8558 
8559  void LookupOverloadedBinOp(OverloadCandidateSet &CandidateSet,
8561  const UnresolvedSetImpl &Fns,
8562  ArrayRef<Expr *> Args, bool RequiresADL = true);
8564  const UnresolvedSetImpl &Fns, Expr *LHS,
8565  Expr *RHS, bool RequiresADL = true,
8566  bool AllowRewrittenCandidates = true,
8567  FunctionDecl *DefaultedFn = nullptr);
8569  const UnresolvedSetImpl &Fns,
8570  Expr *LHS, Expr *RHS,
8571  FunctionDecl *DefaultedFn);
8572 
8574  SourceLocation RLoc, Expr *Base,
8575  MultiExprArg Args);
8576 
8578  Scope *S, Expr *MemExpr, SourceLocation LParenLoc, MultiExprArg Args,
8579  SourceLocation RParenLoc, Expr *ExecConfig = nullptr,
8580  bool IsExecConfig = false, bool AllowRecovery = false);
8582  SourceLocation LParenLoc,
8583  MultiExprArg Args,
8584  SourceLocation RParenLoc);
8585 
8587  SourceLocation OpLoc,
8588  bool *NoArrowOperatorFound = nullptr);
8589 
8591  CXXConversionDecl *Method,
8592  bool HadMultipleCandidates);
8593 
8595  LookupResult &R, DeclarationNameInfo &SuffixInfo, ArrayRef<Expr *> Args,
8596  SourceLocation LitEndLoc,
8597  TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
8598 
8600  FunctionDecl *Fn);
8602  DeclAccessPair FoundDecl,
8603  FunctionDecl *Fn);
8604 
8605 private:
8606  /// - Returns a selector which best matches given argument list or
8607  /// nullptr if none could be found
8608  ObjCMethodDecl *SelectBestMethod(Selector Sel, MultiExprArg Args,
8609  bool IsInstance,
8611 
8612  ///@}
8613 
8614  //
8615  //
8616  // -------------------------------------------------------------------------
8617  //
8618  //
8619 
8620  /// \name Pseudo-Object
8621  /// Implementations are in SemaPseudoObject.cpp
8622  ///@{
8623 
8624 public:
8627 
8630 
8635  Expr *RHS);
8638 
8639  ///@}
8640 
8641  //
8642  //
8643  // -------------------------------------------------------------------------
8644  //
8645  //
8646 
8647  /// \name Statements
8648  /// Implementations are in SemaStmt.cpp
8649  ///@{
8650 
8651 public:
8652  /// Stack of active SEH __finally scopes. Can be empty.
8654 
8655  StmtResult ActOnExprStmt(ExprResult Arg, bool DiscardedValue = true);
8657 
8659  bool HasLeadingEmptyMacro = false);
8660 
8662  SourceLocation EndLoc);
8664 
8665  /// DiagnoseUnusedExprResult - If the statement passed in is an expression
8666  /// whose result is unused, warn.
8667  void DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID);
8668 
8669  void ActOnStartOfCompoundStmt(bool IsStmtExpr);
8673  ArrayRef<Stmt *> Elts, bool isStmtExpr);
8674 
8676 
8679  SourceLocation DotDotDotLoc, ExprResult RHS,
8680  SourceLocation ColonLoc);
8681  void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt);
8682 
8684  SourceLocation ColonLoc, Stmt *SubStmt,
8685  Scope *CurScope);
8687  SourceLocation ColonLoc, Stmt *SubStmt);
8688 
8690  ArrayRef<const Attr *> Attrs, Stmt *SubStmt);
8692  Stmt *SubStmt);
8693 
8694  /// Check whether the given statement can have musttail applied to it,
8695  /// issuing a diagnostic and returning false if not. In the success case,
8696  /// the statement is rewritten to remove implicit nodes from the return
8697  /// value.
8698  bool checkAndRewriteMustTailAttr(Stmt *St, const Attr &MTA);
8699 
8701  SourceLocation LParenLoc, Stmt *InitStmt,
8702  ConditionResult Cond, SourceLocation RParenLoc,
8703  Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal);
8705  SourceLocation LParenLoc, Stmt *InitStmt,
8706  ConditionResult Cond, SourceLocation RParenLoc,
8707  Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal);
8708 
8710 
8712  SourceLocation LParenLoc, Stmt *InitStmt,
8713  ConditionResult Cond,
8714  SourceLocation RParenLoc);
8716  Stmt *Body);
8717 
8718  /// DiagnoseAssignmentEnum - Warn if assignment to enum is a constant
8719  /// integer not in the range of enum values.
8720  void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType,
8721  Expr *SrcExpr);
8722 
8724  ConditionResult Cond, SourceLocation RParenLoc,
8725  Stmt *Body);
8727  SourceLocation WhileLoc, SourceLocation CondLParen,
8728  Expr *Cond, SourceLocation CondRParen);
8729 
8731  Stmt *First, ConditionResult Second,
8732  FullExprArg Third, SourceLocation RParenLoc,
8733  Stmt *Body);
8734 
8736 
8738  Expr *collection);
8740  Expr *collection,
8741  SourceLocation RParenLoc);
8742  StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body);
8743 
8745  /// Initial building of a for-range statement.
8747  /// Instantiation or recovery rebuild of a for-range statement. Don't
8748  /// attempt any typo-correction.
8750  /// Determining whether a for-range statement could be built. Avoid any
8751  /// unnecessary or irreversible actions.
8752  BFRK_Check
8753  };
8754 
8756  Scope *S, SourceLocation ForLoc, SourceLocation CoawaitLoc,
8757  Stmt *InitStmt, Stmt *LoopVar, SourceLocation ColonLoc, Expr *Collection,
8759  ArrayRef<MaterializeTemporaryExpr *> LifetimeExtendTemps = {});
8761  SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt,
8762  SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End,
8763  Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc,
8765  ArrayRef<MaterializeTemporaryExpr *> LifetimeExtendTemps = {});
8766  StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body);
8767 
8768  StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc,
8769  LabelDecl *TheDecl);
8770  StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc,
8771  SourceLocation StarLoc, Expr *DestExp);
8772  StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope);
8773  StmtResult ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope);
8774 
8777 
8778  enum Status : uint8_t { None, MoveEligible, MoveEligibleAndCopyElidable };
8780 
8781  bool isMoveEligible() const { return S != None; };
8782  bool isCopyElidable() const { return S == MoveEligibleAndCopyElidable; }
8783  };
8784  enum class SimplerImplicitMoveMode { ForceOff, Normal, ForceOn };
8785  NamedReturnInfo getNamedReturnInfo(
8787  NamedReturnInfo getNamedReturnInfo(const VarDecl *VD);
8788  const VarDecl *getCopyElisionCandidate(NamedReturnInfo &Info,
8789  QualType ReturnType);
8790 
8791  ExprResult
8793  const NamedReturnInfo &NRInfo, Expr *Value,
8794  bool SupressSimplerImplicitMoves = false);
8795 
8797 
8799  SourceLocation ReturnLoc, Expr *RetExpr,
8800  const AutoType *AT);
8801 
8802  StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
8803  Scope *CurScope);
8804  StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
8805  bool AllowRecovery = false);
8806  StmtResult ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
8807  NamedReturnInfo &NRInfo,
8808  bool SupressSimplerImplicitMoves);
8809 
8811  Decl *Parm, Stmt *Body);
8812 
8814 
8816  MultiStmtArg Catch, Stmt *Finally);
8817 
8820  Scope *CurScope);
8822  Expr *operand);
8824  Stmt *SynchBody);
8825 
8827 
8829  Stmt *HandlerBlock);
8830  StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock,
8831  ArrayRef<Stmt *> Handlers);
8832 
8833  StmtResult ActOnSEHTryBlock(bool IsCXXTry, // try (true) or __try (false) ?
8834  SourceLocation TryLoc, Stmt *TryBlock,
8835  Stmt *Handler);
8837  Stmt *Block);
8842 
8844  bool IsIfExists,
8845  NestedNameSpecifierLoc QualifierLoc,
8846  DeclarationNameInfo NameInfo,
8847  Stmt *Nested);
8849  bool IsIfExists, CXXScopeSpec &SS,
8850  UnqualifiedId &Name, Stmt *Nested);
8851 
8852  void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
8853  CapturedRegionKind Kind, unsigned NumParams);
8854  typedef std::pair<StringRef, QualType> CapturedParamNameType;
8855  void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
8858  unsigned OpenMPCaptureLevel = 0);
8860  void ActOnCapturedRegionError();
8862  SourceLocation Loc,
8863  unsigned NumParams);
8864 
8865 private:
8866  /// Check whether the given statement can have musttail applied to it,
8867  /// issuing a diagnostic and returning false if not.
8868  bool checkMustTailAttr(const Stmt *St, const Attr &MTA);
8869 
8870  /// Check if the given expression contains 'break' or 'continue'
8871  /// statement that produces control flow different from GCC.
8872  void CheckBreakContinueBinding(Expr *E);
8873 
8874  ///@}
8875 
8876  //
8877  //
8878  // -------------------------------------------------------------------------
8879  //
8880  //
8881 
8882  /// \name `inline asm` Statement
8883  /// Implementations are in SemaStmtAsm.cpp
8884  ///@{
8885 
8886 public:
8887  StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
8888  bool IsVolatile, unsigned NumOutputs,
8889  unsigned NumInputs, IdentifierInfo **Names,
8890  MultiExprArg Constraints, MultiExprArg Exprs,
8891  Expr *AsmString, MultiExprArg Clobbers,
8892  unsigned NumLabels, SourceLocation RParenLoc);
8893 
8895  llvm::InlineAsmIdentifierInfo &Info);
8897  SourceLocation TemplateKWLoc,
8898  UnqualifiedId &Id,
8899  bool IsUnevaluatedContext);
8900  bool LookupInlineAsmField(StringRef Base, StringRef Member, unsigned &Offset,
8901  SourceLocation AsmLoc);
8902  ExprResult LookupInlineAsmVarDeclField(Expr *RefExpr, StringRef Member,
8903  SourceLocation AsmLoc);
8905  ArrayRef<Token> AsmToks, StringRef AsmString,
8906  unsigned NumOutputs, unsigned NumInputs,
8907  ArrayRef<StringRef> Constraints,
8908  ArrayRef<StringRef> Clobbers,
8909  ArrayRef<Expr *> Exprs, SourceLocation EndLoc);
8910  LabelDecl *GetOrCreateMSAsmLabel(StringRef ExternalLabelName,
8911  SourceLocation Location, bool AlwaysCreate);
8912 
8913  ///@}
8914 
8915  //
8916  //
8917  // -------------------------------------------------------------------------
8918  //
8919  //
8920 
8921  /// \name Statement Attribute Handling
8922  /// Implementations are in SemaStmtAttr.cpp
8923  ///@{
8924 
8925 public:
8926  bool CheckNoInlineAttr(const Stmt *OrigSt, const Stmt *CurSt,
8927  const AttributeCommonInfo &A);
8928  bool CheckAlwaysInlineAttr(const Stmt *OrigSt, const Stmt *CurSt,
8929  const AttributeCommonInfo &A);
8930 
8931  CodeAlignAttr *BuildCodeAlignAttr(const AttributeCommonInfo &CI, Expr *E);
8933 
8934  /// Process the attributes before creating an attributed statement. Returns
8935  /// the semantic attributes that have been processed.
8936  void ProcessStmtAttributes(Stmt *Stmt, const ParsedAttributes &InAttrs,
8937  SmallVectorImpl<const Attr *> &OutAttrs);
8938 
8940  SourceRange Range);
8941  ExprResult BuildCXXAssumeExpr(Expr *Assumption,
8942  const IdentifierInfo *AttrName,
8943  SourceRange Range);
8944 
8945  SYCLIntelIVDepAttr *BuildSYCLIntelIVDepAttr(const AttributeCommonInfo &CI,
8946  Expr *Expr1, Expr *Expr2);
8947  LoopUnrollHintAttr *BuildLoopUnrollHintAttr(const AttributeCommonInfo &A,
8948  Expr *E);
8949  OpenCLUnrollHintAttr *
8951 
8952  SYCLIntelLoopCountAttr *
8954  SYCLIntelInitiationIntervalAttr *
8956  SYCLIntelMaxConcurrencyAttr *
8958  SYCLIntelMaxInterleavingAttr *
8960  SYCLIntelSpeculatedIterationsAttr *
8962  Expr *E);
8963  SYCLIntelLoopCoalesceAttr *
8965  SYCLIntelMaxReinvocationDelayAttr *
8967  Expr *E);
8968 
8969  ///@}
8970 
8971  //
8972  //
8973  // -------------------------------------------------------------------------
8974  //
8975  //
8976 
8977  /// \name C++ Templates
8978  /// Implementations are in SemaTemplate.cpp
8979  ///@{
8980 
8981 public:
8982  // Saves the current floating-point pragma stack and clear it in this Sema.
8984  public:
8986  : S(S), SavedStack(std::move(S.FpPragmaStack)) {
8987  S.FpPragmaStack.Stack.clear();
8988  }
8989  ~FpPragmaStackSaveRAII() { S.FpPragmaStack = std::move(SavedStack); }
8990 
8991  private:
8992  Sema &S;
8993  PragmaStack<FPOptionsOverride> SavedStack;
8994  };
8995 
8997  CurFPFeatures = FPO;
8998  FpPragmaStack.CurrentValue = FPO.getChangesFrom(FPOptions(LangOpts));
8999  }
9000 
9002  return llvm::ArrayRef(InventedParameterInfos.begin() +
9004  InventedParameterInfos.end());
9005  }
9006 
9007  /// The number of SFINAE diagnostics that have been trapped.
9009 
9012  FunctionScopes.end());
9013  }
9014 
9015  typedef llvm::MapVector<const FunctionDecl *,
9016  std::unique_ptr<LateParsedTemplate>>
9019 
9020  /// Determine the number of levels of enclosing template parameters. This is
9021  /// only usable while parsing. Note that this does not include dependent
9022  /// contexts in which no template parameters have yet been declared, such as
9023  /// in a terse function template or generic lambda before the first 'auto' is
9024  /// encountered.
9025  unsigned getTemplateDepth(Scope *S) const;
9026 
9028  bool AllowFunctionTemplates = true,
9029  bool AllowDependent = true);
9031  bool AllowFunctionTemplates = true,
9032  bool AllowDependent = true,
9033  bool AllowNonTemplateFunctions = false);
9034  /// Try to interpret the lookup result D as a template-name.
9035  ///
9036  /// \param D A declaration found by name lookup.
9037  /// \param AllowFunctionTemplates Whether function templates should be
9038  /// considered valid results.
9039  /// \param AllowDependent Whether unresolved using declarations (that might
9040  /// name templates) should be considered valid results.
9042  bool AllowFunctionTemplates = true,
9043  bool AllowDependent = true);
9044 
9046  /// Whether and why a template name is required in this lookup.
9048  public:
9049  /// Template name is required if TemplateKWLoc is valid.
9051  : TemplateKW(TemplateKWLoc) {}
9052  /// Template name is unconditionally required.
9054 
9056  return TemplateKW.value_or(SourceLocation());
9057  }
9058  bool hasTemplateKeyword() const {
9059  return getTemplateKeywordLoc().isValid();
9060  }
9061  bool isRequired() const { return TemplateKW != SourceLocation(); }
9062  explicit operator bool() const { return isRequired(); }
9063 
9064  private:
9065  std::optional<SourceLocation> TemplateKW;
9066  };
9067 
9068  enum class AssumedTemplateKind {
9069  /// This is not assumed to be a template name.
9070  None,
9071  /// This is assumed to be a template name because lookup found nothing.
9072  FoundNothing,
9073  /// This is assumed to be a template name because lookup found one or more
9074  /// functions (but no function templates).
9075  FoundFunctions,
9076  };
9077  bool LookupTemplateName(
9078  LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType,
9079  bool EnteringContext, bool &MemberOfUnknownSpecialization,
9080  RequiredTemplateKind RequiredTemplate = SourceLocation(),
9081  AssumedTemplateKind *ATK = nullptr, bool AllowTypoCorrection = true);
9082 
9084  bool hasTemplateKeyword,
9085  const UnqualifiedId &Name,
9086  ParsedType ObjectType, bool EnteringContext,
9087  TemplateTy &Template,
9088  bool &MemberOfUnknownSpecialization,
9089  bool Disambiguation = false);
9090 
9091  /// Try to resolve an undeclared template name as a type template.
9092  ///
9093  /// Sets II to the identifier corresponding to the template name, and updates
9094  /// Name to a corresponding (typo-corrected) type template name and TNK to
9095  /// the corresponding kind, if possible.
9097  TemplateNameKind &TNK,
9098  SourceLocation NameLoc,
9099  IdentifierInfo *&II);
9100 
9102  SourceLocation NameLoc,
9103  bool Diagnose = true);
9104 
9105  /// Determine whether a particular identifier might be the name in a C++1z
9106  /// deduction-guide declaration.
9107  bool isDeductionGuideName(Scope *S, const IdentifierInfo &Name,
9108  SourceLocation NameLoc, CXXScopeSpec &SS,
9109  ParsedTemplateTy *Template = nullptr);
9110 
9112  SourceLocation IILoc, Scope *S,
9113  const CXXScopeSpec *SS,
9114  TemplateTy &SuggestedTemplate,
9115  TemplateNameKind &SuggestedKind);
9116 
9117  bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation,
9118  NamedDecl *Instantiation,
9119  bool InstantiatedFromMember,
9120  const NamedDecl *Pattern,
9121  const NamedDecl *PatternDef,
9123  bool Complain = true);
9124 
9125  /// DiagnoseTemplateParameterShadow - Produce a diagnostic complaining
9126  /// that the template parameter 'PrevDecl' is being shadowed by a new
9127  /// declaration at location Loc. Returns true to indicate that this is
9128  /// an error, and false otherwise.
9129  ///
9130  /// \param Loc The location of the declaration that shadows a template
9131  /// parameter.
9132  ///
9133  /// \param PrevDecl The template parameter that the declaration shadows.
9134  ///
9135  /// \param SupportedForCompatibility Whether to issue the diagnostic as
9136  /// a warning for compatibility with older versions of clang.
9137  /// Ignored when MSVC compatibility is enabled.
9139  bool SupportedForCompatibility = false);
9141 
9142  NamedDecl *ActOnTypeParameter(Scope *S, bool Typename,
9143  SourceLocation EllipsisLoc,
9144  SourceLocation KeyLoc,
9145  IdentifierInfo *ParamName,
9146  SourceLocation ParamNameLoc, unsigned Depth,
9147  unsigned Position, SourceLocation EqualLoc,
9148  ParsedType DefaultArg, bool HasTypeConstraint);
9149 
9151 
9152  bool ActOnTypeConstraint(const CXXScopeSpec &SS,
9154  TemplateTypeParmDecl *ConstrainedParameter,
9155  SourceLocation EllipsisLoc);
9156  bool BuildTypeConstraint(const CXXScopeSpec &SS,
9158  TemplateTypeParmDecl *ConstrainedParameter,
9159  SourceLocation EllipsisLoc,
9160  bool AllowUnexpandedPack);
9161 
9163  DeclarationNameInfo NameInfo,
9164  ConceptDecl *NamedConcept, NamedDecl *FoundDecl,
9165  const TemplateArgumentListInfo *TemplateArgs,
9166  TemplateTypeParmDecl *ConstrainedParameter,
9167  SourceLocation EllipsisLoc);
9168 
9170  NonTypeTemplateParmDecl *NewConstrainedParm,
9171  NonTypeTemplateParmDecl *OrigConstrainedParm,
9172  SourceLocation EllipsisLoc);
9173 
9175 
9177  SourceLocation Loc);
9179 
9181  unsigned Depth, unsigned Position,
9182  SourceLocation EqualLoc,
9183  Expr *DefaultArg);
9185  Scope *S, SourceLocation TmpLoc, TemplateParameterList *Params,
9186  bool Typename, SourceLocation EllipsisLoc, IdentifierInfo *ParamName,
9187  SourceLocation ParamNameLoc, unsigned Depth, unsigned Position,
9188  SourceLocation EqualLoc, ParsedTemplateArgument DefaultArg);
9189 
9191  unsigned Depth, SourceLocation ExportLoc, SourceLocation TemplateLoc,
9192  SourceLocation LAngleLoc, ArrayRef<NamedDecl *> Params,
9193  SourceLocation RAngleLoc, Expr *RequiresClause);
9194 
9195  /// The context in which we are checking a template parameter list.
9205  };
9206 
9208  TemplateParameterList *OldParams,
9210  SkipBodyInfo *SkipBody = nullptr);
9212  SourceLocation DeclStartLoc, SourceLocation DeclLoc,
9213  const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId,
9214  ArrayRef<TemplateParameterList *> ParamLists, bool IsFriend,
9215  bool &IsMemberSpecialization, bool &Invalid,
9216  bool SuppressDiagnostic = false);
9217 
9219  Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
9220  CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc,
9221  const ParsedAttributesView &Attr, TemplateParameterList *TemplateParams,
9222  AccessSpecifier AS, SourceLocation ModulePrivateLoc,
9223  SourceLocation FriendLoc, unsigned NumOuterTemplateParamLists,
9224  TemplateParameterList **OuterTemplateParamLists,
9225  SkipBodyInfo *SkipBody = nullptr);
9226 
9229 
9231 
9233 
9235  SourceLocation TemplateLoc,
9236  TemplateArgumentListInfo &TemplateArgs);
9237 
9238  TypeResult
9239  ActOnTemplateIdType(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
9240  TemplateTy Template, const IdentifierInfo *TemplateII,
9241  SourceLocation TemplateIILoc, SourceLocation LAngleLoc,
9242  ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc,
9243  bool IsCtorOrDtorName = false, bool IsClassName = false,
9244  ImplicitTypenameContext AllowImplicitTypename =
9246 
9247  /// Parsed an elaborated-type-specifier that refers to a template-id,
9248  /// such as \c class T::template apply<U>.
9250  TagUseKind TUK, TypeSpecifierType TagSpec, SourceLocation TagLoc,
9251  CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy TemplateD,
9252  SourceLocation TemplateLoc, SourceLocation LAngleLoc,
9253  ASTTemplateArgsPtr TemplateArgsIn, SourceLocation RAngleLoc);
9254 
9257  SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams,
9259 
9260  /// Get the specialization of the given variable template corresponding to
9261  /// the specified argument list, or a null-but-valid result if the arguments
9262  /// are dependent.
9264  SourceLocation TemplateLoc,
9265  SourceLocation TemplateNameLoc,
9266  const TemplateArgumentListInfo &TemplateArgs);
9267 
9268  /// Form a reference to the specialization of the given variable template
9269  /// corresponding to the specified argument list, or a null-but-valid result
9270  /// if the arguments are dependent.
9272  const DeclarationNameInfo &NameInfo,
9273  VarTemplateDecl *Template, NamedDecl *FoundD,
9274  SourceLocation TemplateLoc,
9275  const TemplateArgumentListInfo *TemplateArgs);
9276 
9277  ExprResult
9278  CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
9279  const DeclarationNameInfo &ConceptNameInfo,
9280  NamedDecl *FoundDecl, ConceptDecl *NamedConcept,
9281  const TemplateArgumentListInfo *TemplateArgs);
9282 
9284 
9286  SourceLocation TemplateKWLoc, LookupResult &R,
9287  bool RequiresADL,
9288  const TemplateArgumentListInfo *TemplateArgs);
9289 
9290  ExprResult
9292  const DeclarationNameInfo &NameInfo,
9293  const TemplateArgumentListInfo *TemplateArgs);
9294 
9296  SourceLocation TemplateKWLoc,
9297  const UnqualifiedId &Name,
9298  ParsedType ObjectType,
9299  bool EnteringContext, TemplateTy &Template,
9300  bool AllowInjectedClassName = false);
9301 
9303  Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
9304  SourceLocation ModulePrivateLoc, CXXScopeSpec &SS,
9305  TemplateIdAnnotation &TemplateId, const ParsedAttributesView &Attr,
9306  MultiTemplateParamsArg TemplateParameterLists,
9307  SkipBodyInfo *SkipBody = nullptr);
9308 
9310  TemplateDecl *PrimaryTemplate,
9311  unsigned NumExplicitArgs,
9317 
9319  MultiTemplateParamsArg TemplateParameterLists,
9320  Declarator &D);
9321 
9323  SourceLocation NewLoc,
9324  TemplateSpecializationKind ActOnExplicitInstantiationNewTSK,
9325  NamedDecl *PrevDecl, TemplateSpecializationKind PrevTSK,
9326  SourceLocation PrevPtOfInstantiation, bool &SuppressNew);
9327 
9329  FunctionDecl *FD, const TemplateArgumentListInfo *ExplicitTemplateArgs,
9331 
9333  FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs,
9334  LookupResult &Previous, bool QualifiedFriend = false);
9337 
9339  Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc,
9340  unsigned TagSpec, SourceLocation KWLoc, const CXXScopeSpec &SS,
9341  TemplateTy Template, SourceLocation TemplateNameLoc,
9342  SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs,
9343  SourceLocation RAngleLoc, const ParsedAttributesView &Attr);
9344 
9346  SourceLocation TemplateLoc,
9347  unsigned TagSpec, SourceLocation KWLoc,
9348  CXXScopeSpec &SS, IdentifierInfo *Name,
9349  SourceLocation NameLoc,
9350  const ParsedAttributesView &Attr);
9351 
9353  SourceLocation TemplateLoc,
9354  Declarator &D);
9355 
9357  TemplateDecl *Template, SourceLocation TemplateLoc,
9358  SourceLocation RAngleLoc, Decl *Param,
9359  ArrayRef<TemplateArgument> SugaredConverted,
9360  ArrayRef<TemplateArgument> CanonicalConverted, bool &HasDefaultArg);
9361 
9363 
9364  /// Specifies the context in which a particular template
9365  /// argument is being checked.
9367  /// The template argument was specified in the code or was
9368  /// instantiated with some deduced template arguments.
9370 
9371  /// The template argument was deduced via template argument
9372  /// deduction.
9374 
9375  /// The template argument was deduced from an array bound
9376  /// via template argument deduction.
9378  };
9379 
9380  bool
9382  NamedDecl *Template, SourceLocation TemplateLoc,
9383  SourceLocation RAngleLoc, unsigned ArgumentPackIndex,
9384  SmallVectorImpl<TemplateArgument> &SugaredConverted,
9385  SmallVectorImpl<TemplateArgument> &CanonicalConverted,
9387 
9388  /// Check that the given template arguments can be provided to
9389  /// the given template, converting the arguments along the way.
9390  ///
9391  /// \param Template The template to which the template arguments are being
9392  /// provided.
9393  ///
9394  /// \param TemplateLoc The location of the template name in the source.
9395  ///
9396  /// \param TemplateArgs The list of template arguments. If the template is
9397  /// a template template parameter, this function may extend the set of
9398  /// template arguments to also include substituted, defaulted template
9399  /// arguments.
9400  ///
9401  /// \param PartialTemplateArgs True if the list of template arguments is
9402  /// intentionally partial, e.g., because we're checking just the initial
9403  /// set of template arguments.
9404  ///
9405  /// \param Converted Will receive the converted, canonicalized template
9406  /// arguments.
9407  ///
9408  /// \param UpdateArgsWithConversions If \c true, update \p TemplateArgs to
9409  /// contain the converted forms of the template arguments as written.
9410  /// Otherwise, \p TemplateArgs will not be modified.
9411  ///
9412  /// \param ConstraintsNotSatisfied If provided, and an error occurred, will
9413  /// receive true if the cause for the error is the associated constraints of
9414  /// the template not being satisfied by the template arguments.
9415  ///
9416  /// \returns true if an error occurred, false otherwise.
9418  TemplateDecl *Template, SourceLocation TemplateLoc,
9419  TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs,
9420  SmallVectorImpl<TemplateArgument> &SugaredConverted,
9421  SmallVectorImpl<TemplateArgument> &CanonicalConverted,
9422  bool UpdateArgsWithConversions = true,
9423  bool *ConstraintsNotSatisfied = nullptr);
9424 
9427  SmallVectorImpl<TemplateArgument> &SugaredConverted,
9428  SmallVectorImpl<TemplateArgument> &CanonicalConverted);
9429 
9432  QualType InstantiatedParamType, Expr *Arg,
9433  TemplateArgument &SugaredConverted,
9434  TemplateArgument &CanonicalConverted,
9437  TemplateParameterList *Params,
9438  TemplateArgumentLoc &Arg);
9439 
9440  void NoteTemplateLocation(const NamedDecl &Decl,
9441  std::optional<SourceRange> ParamRange = {});
9442  void NoteTemplateParameterLocation(const NamedDecl &Decl);
9443 
9445  const TemplateArgument &Arg, QualType ParamType, SourceLocation Loc);
9446  ExprResult
9447  BuildExpressionFromNonTypeTemplateArgument(const TemplateArgument &Arg,
9448  SourceLocation Loc);
9449 
9450  /// Enumeration describing how template parameter lists are compared
9451  /// for equality.
9453  /// We are matching the template parameter lists of two templates
9454  /// that might be redeclarations.
9455  ///
9456  /// \code
9457  /// template<typename T> struct X;
9458  /// template<typename T> struct X;
9459  /// \endcode
9461 
9462  /// We are matching the template parameter lists of two template
9463  /// template parameters as part of matching the template parameter lists
9464  /// of two templates that might be redeclarations.
9465  ///
9466  /// \code
9467  /// template<template<int I> class TT> struct X;
9468  /// template<template<int Value> class Other> struct X;
9469  /// \endcode
9471 
9472  /// We are matching the template parameter lists of a template
9473  /// template argument against the template parameter lists of a template
9474  /// template parameter.
9475  ///
9476  /// \code
9477  /// template<template<int Value> class Metafun> struct X;
9478  /// template<int Value> struct integer_c;
9479  /// X<integer_c> xic;
9480  /// \endcode
9482 
9483  /// We are determining whether the template-parameters are equivalent
9484  /// according to C++ [temp.over.link]/6. This comparison does not consider
9485  /// constraints.
9486  ///
9487  /// \code
9488  /// template<C1 T> void f(T);
9489  /// template<C2 T> void f(T);
9490  /// \endcode
9492  };
9493 
9494  // A struct to represent the 'new' declaration, which is either itself just
9495  // the named decl, or the important information we need about it in order to
9496  // do constraint comparisons.
9498  const NamedDecl *ND = nullptr;
9499  const DeclContext *DC = nullptr;
9500  const DeclContext *LexicalDC = nullptr;
9501  SourceLocation Loc;
9502 
9503  public:
9504  TemplateCompareNewDeclInfo(const NamedDecl *ND) : ND(ND) {}
9506  const DeclContext *LexicalDeclCtx,
9507  SourceLocation Loc)
9508 
9509  : DC(DeclCtx), LexicalDC(LexicalDeclCtx), Loc(Loc) {
9510  assert(DC && LexicalDC &&
9511  "Constructor only for cases where we have the information to put "
9512  "in here");
9513  }
9514 
9515  // If this was constructed with no information, we cannot do substitution
9516  // for constraint comparison, so make sure we can check that.
9517  bool isInvalid() const { return !ND && !DC; }
9518 
9519  const NamedDecl *getDecl() const { return ND; }
9520 
9521  bool ContainsDecl(const NamedDecl *ND) const { return this->ND == ND; }
9522 
9524  return ND ? ND->getLexicalDeclContext() : LexicalDC;
9525  }
9526 
9527  const DeclContext *getDeclContext() const {
9528  return ND ? ND->getDeclContext() : DC;
9529  }
9530 
9531  SourceLocation getLocation() const { return ND ? ND->getLocation() : Loc; }
9532  };
9533 
9535  const TemplateCompareNewDeclInfo &NewInstFrom, TemplateParameterList *New,
9536  const NamedDecl *OldInstFrom, TemplateParameterList *Old, bool Complain,
9538  SourceLocation TemplateArgLoc = SourceLocation());
9539 
9541  TemplateParameterList *New, TemplateParameterList *Old, bool Complain,
9543  SourceLocation TemplateArgLoc = SourceLocation()) {
9544  return TemplateParameterListsAreEqual(nullptr, New, nullptr, Old, Complain,
9545  Kind, TemplateArgLoc);
9546  }
9547 
9548  bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams);
9549 
9550  /// Called when the parser has parsed a C++ typename
9551  /// specifier, e.g., "typename T::type".
9552  ///
9553  /// \param S The scope in which this typename type occurs.
9554  /// \param TypenameLoc the location of the 'typename' keyword
9555  /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
9556  /// \param II the identifier we're retrieving (e.g., 'type' in the example).
9557  /// \param IdLoc the location of the identifier.
9558  /// \param IsImplicitTypename context where T::type refers to a type.
9560  Scope *S, SourceLocation TypenameLoc, const CXXScopeSpec &SS,
9561  const IdentifierInfo &II, SourceLocation IdLoc,
9563 
9564  /// Called when the parser has parsed a C++ typename
9565  /// specifier that ends in a template-id, e.g.,
9566  /// "typename MetaFun::template apply<T1, T2>".
9567  ///
9568  /// \param S The scope in which this typename type occurs.
9569  /// \param TypenameLoc the location of the 'typename' keyword
9570  /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
9571  /// \param TemplateLoc the location of the 'template' keyword, if any.
9572  /// \param TemplateName The template name.
9573  /// \param TemplateII The identifier used to name the template.
9574  /// \param TemplateIILoc The location of the template name.
9575  /// \param LAngleLoc The location of the opening angle bracket ('<').
9576  /// \param TemplateArgs The template arguments.
9577  /// \param RAngleLoc The location of the closing angle bracket ('>').
9578  TypeResult
9579  ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
9580  const CXXScopeSpec &SS, SourceLocation TemplateLoc,
9581  TemplateTy TemplateName, const IdentifierInfo *TemplateII,
9582  SourceLocation TemplateIILoc, SourceLocation LAngleLoc,
9583  ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc);
9584 
9586  SourceLocation KeywordLoc,
9587  NestedNameSpecifierLoc QualifierLoc,
9588  const IdentifierInfo &II, SourceLocation IILoc,
9589  TypeSourceInfo **TSI, bool DeducedTSTContext);
9590 
9592  SourceLocation KeywordLoc,
9593  NestedNameSpecifierLoc QualifierLoc,
9594  const IdentifierInfo &II, SourceLocation IILoc,
9595  bool DeducedTSTContext = true);
9596 
9598  SourceLocation Loc,
9599  DeclarationName Name);
9601 
9603  bool
9605 
9606  std::string
9608  const TemplateArgumentList &Args);
9609 
9610  std::string
9612  const TemplateArgument *Args,
9613  unsigned NumArgs);
9614 
9616  SourceLocation Less,
9617  SourceLocation Greater);
9618 
9620  const CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
9621  const DeclarationNameInfo &NameInfo, bool isAddressOfOperand,
9622  const TemplateArgumentListInfo *TemplateArgs);
9623 
9624  ExprResult
9626  SourceLocation TemplateKWLoc,
9627  const DeclarationNameInfo &NameInfo,
9628  const TemplateArgumentListInfo *TemplateArgs);
9629 
9630  // Calculates whether the expression Constraint depends on an enclosing
9631  // template, for the purposes of [temp.friend] p9.
9632  // TemplateDepth is the 'depth' of the friend function, which is used to
9633  // compare whether a declaration reference is referring to a containing
9634  // template, or just the current friend function. A 'lower' TemplateDepth in
9635  // the AST refers to a 'containing' template. As the constraint is
9636  // uninstantiated, this is relative to the 'top' of the TU.
9637  bool
9639  unsigned TemplateDepth,
9640  const Expr *Constraint);
9641 
9642  /// Declare implicit deduction guides for a class template if we've
9643  /// not already done so.
9645  SourceLocation Loc);
9646 
9648  TemplateDecl *Template, MutableArrayRef<QualType> ParamTypes,
9649  SourceLocation Loc);
9650 
9651  /// Find the failed Boolean condition within a given Boolean
9652  /// constant expression, and describe it with a string.
9653  std::pair<Expr *, std::string> findFailedBooleanCondition(Expr *Cond);
9654 
9656 
9658  MultiTemplateParamsArg TemplateParameterLists,
9659  const IdentifierInfo *Name,
9660  SourceLocation NameLoc, Expr *ConstraintExpr);
9661 
9663  bool &AddToScope);
9664 
9665  TypeResult ActOnDependentTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
9666  const CXXScopeSpec &SS,
9667  const IdentifierInfo *Name,
9668  SourceLocation TagLoc, SourceLocation NameLoc);
9669 
9671  CachedTokens &Toks);
9674 
9675  /// We've found a use of a templated declaration that would trigger an
9676  /// implicit instantiation. Check that any relevant explicit specializations
9677  /// and partial specializations are visible/reachable, and diagnose if not.
9680 
9681  ///@}
9682 
9683  //
9684  //
9685  // -------------------------------------------------------------------------
9686  //
9687  //
9688 
9689  /// \name C++ Template Argument Deduction
9690  /// Implementations are in SemaTemplateDeduction.cpp
9691  ///@{
9692 
9693 public:
9694  /// When true, access checking violations are treated as SFINAE
9695  /// failures rather than hard errors.
9697 
9698  /// RAII class used to determine whether SFINAE has
9699  /// trapped any errors that occur during template argument
9700  /// deduction.
9701  class SFINAETrap {
9702  Sema &SemaRef;
9703  unsigned PrevSFINAEErrors;
9704  bool PrevInNonInstantiationSFINAEContext;
9705  bool PrevAccessCheckingSFINAE;
9706  bool PrevLastDiagnosticIgnored;
9707 
9708  public:
9709  explicit SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE = false)
9710  : SemaRef(SemaRef), PrevSFINAEErrors(SemaRef.NumSFINAEErrors),
9711  PrevInNonInstantiationSFINAEContext(
9713  PrevAccessCheckingSFINAE(SemaRef.AccessCheckingSFINAE),
9714  PrevLastDiagnosticIgnored(
9715  SemaRef.getDiagnostics().isLastDiagnosticIgnored()) {
9716  if (!SemaRef.isSFINAEContext())
9719  }
9720 
9722  SemaRef.NumSFINAEErrors = PrevSFINAEErrors;
9724  PrevInNonInstantiationSFINAEContext;
9725  SemaRef.AccessCheckingSFINAE = PrevAccessCheckingSFINAE;
9727  PrevLastDiagnosticIgnored);
9728  }
9729 
9730  /// Determine whether any SFINAE errors have been trapped.
9731  bool hasErrorOccurred() const {
9732  return SemaRef.NumSFINAEErrors > PrevSFINAEErrors;
9733  }
9734  };
9735 
9736  /// RAII class used to indicate that we are performing provisional
9737  /// semantic analysis to determine the validity of a construct, so
9738  /// typo-correction and diagnostics in the immediate context (not within
9739  /// implicitly-instantiated templates) should be suppressed.
9741  Sema &SemaRef;
9742  // FIXME: Using a SFINAETrap for this is a hack.
9743  SFINAETrap Trap;
9744  bool PrevDisableTypoCorrection;
9745 
9746  public:
9748  : SemaRef(SemaRef), Trap(SemaRef, true),
9749  PrevDisableTypoCorrection(SemaRef.DisableTypoCorrection) {
9751  }
9753  SemaRef.DisableTypoCorrection = PrevDisableTypoCorrection;
9754  }
9755  };
9756 
9757  /// For each declaration that involved template argument deduction, the
9758  /// set of diagnostics that were suppressed during that template argument
9759  /// deduction.
9760  ///
9761  /// FIXME: Serialize this structure to the AST file.
9762  typedef llvm::DenseMap<Decl *, SmallVector<PartialDiagnosticAt, 1>>
9765 
9767 
9769  QualType NTTPType,
9770  SourceLocation Loc);
9771 
9772  /// Get a template argument mapping the given template parameter to itself,
9773  /// e.g. for X in \c template<int X>, this would return an expression template
9774  /// argument referencing X.
9776  SourceLocation Location);
9777 
9778  /// Adjust the type \p ArgFunctionType to match the calling convention,
9779  /// noreturn, and optionally the exception specification of \p FunctionType.
9780  /// Deduction often wants to ignore these properties when matching function
9781  /// types.
9783  bool AdjustExceptionSpec = false);
9784 
9787  ArrayRef<TemplateArgument> TemplateArgs,
9789 
9792  ArrayRef<TemplateArgument> TemplateArgs,
9794 
9799  bool NumberOfArgumentsMustMatch);
9800 
9802  FunctionTemplateDecl *FunctionTemplate,
9803  TemplateArgumentListInfo &ExplicitTemplateArgs,
9807 
9808  /// brief A function argument from which we performed template argument
9809  // deduction for a call.
9811  OriginalCallArg(QualType OriginalParamType, bool DecomposedParam,
9812  unsigned ArgIdx, QualType OriginalArgType)
9813  : OriginalParamType(OriginalParamType),
9814  DecomposedParam(DecomposedParam), ArgIdx(ArgIdx),
9815  OriginalArgType(OriginalArgType) {}
9816 
9819  unsigned ArgIdx;
9821  };
9822 
9824  FunctionTemplateDecl *FunctionTemplate,
9826  unsigned NumExplicitlySpecified, FunctionDecl *&Specialization,
9828  SmallVectorImpl<OriginalCallArg> const *OriginalCallArgs = nullptr,
9829  bool PartialOverloading = false,
9830  llvm::function_ref<bool()> CheckNonDependent = [] { return false; });
9831 
9833  FunctionTemplateDecl *FunctionTemplate,
9834  TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef<Expr *> Args,
9835  FunctionDecl *&Specialization, sema::TemplateDeductionInfo &Info,
9836  bool PartialOverloading, bool AggregateDeductionCandidate,
9837  QualType ObjectType, Expr::Classification ObjectClassification,
9838  llvm::function_ref<bool(ArrayRef<QualType>)> CheckNonDependent);
9839 
9841  FunctionTemplateDecl *FunctionTemplate,
9842  TemplateArgumentListInfo *ExplicitTemplateArgs, QualType ArgFunctionType,
9843  FunctionDecl *&Specialization, sema::TemplateDeductionInfo &Info,
9844  bool IsAddressOfFunction = false);
9845 
9847  FunctionTemplateDecl *FunctionTemplate, QualType ObjectType,
9848  Expr::Classification ObjectClassification, QualType ToType,
9849  CXXConversionDecl *&Specialization, sema::TemplateDeductionInfo &Info);
9850 
9853  TemplateArgumentListInfo *ExplicitTemplateArgs,
9854  FunctionDecl *&Specialization,
9856  bool IsAddressOfFunction = false);
9857 
9858  /// Substitute Replacement for \p auto in \p TypeWithAuto
9859  QualType SubstAutoType(QualType TypeWithAuto, QualType Replacement);
9860  /// Substitute Replacement for auto in TypeWithAuto
9862  QualType Replacement);
9863 
9864  // Substitute auto in TypeWithAuto for a Dependent auto type
9866 
9867  // Substitute auto in TypeWithAuto for a Dependent auto type
9868  TypeSourceInfo *
9870 
9871  /// Completely replace the \c auto in \p TypeWithAuto by
9872  /// \p Replacement. This does not retain any \c auto type sugar.
9873  QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement);
9875  QualType Replacement);
9876 
9878  DeduceAutoType(TypeLoc AutoTypeLoc, Expr *Initializer, QualType &Result,
9880  bool DependentDeduction = false,
9881  bool IgnoreConstraints = false,
9882  TemplateSpecCandidateSet *FailedTSC = nullptr);
9883  void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init);
9885  bool Diagnose = true);
9886 
9888  SourceLocation Loc);
9889 
9894 
9897 
9901 
9904 
9906  TemplateParameterList *PParam, TemplateDecl *AArg, SourceLocation Loc);
9907 
9908  void MarkUsedTemplateParameters(const Expr *E, bool OnlyDeduced,
9909  unsigned Depth, llvm::SmallBitVector &Used);
9910 
9911  void MarkUsedTemplateParameters(const TemplateArgumentList &TemplateArgs,
9912  bool OnlyDeduced, unsigned Depth,
9913  llvm::SmallBitVector &Used);
9914  void
9916  llvm::SmallBitVector &Deduced) {
9917  return MarkDeducedTemplateParameters(Context, FunctionTemplate, Deduced);
9918  }
9919  static void
9921  const FunctionTemplateDecl *FunctionTemplate,
9922  llvm::SmallBitVector &Deduced);
9923 
9926  TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1,
9927  QualType RawObj1Ty = {}, QualType RawObj2Ty = {}, bool Reversed = false);
9928 
9929  UnresolvedSetIterator
9930  getMostSpecialized(UnresolvedSetIterator SBegin, UnresolvedSetIterator SEnd,
9931  TemplateSpecCandidateSet &FailedCandidates,
9932  SourceLocation Loc, const PartialDiagnostic &NoneDiag,
9933  const PartialDiagnostic &AmbigDiag,
9934  const PartialDiagnostic &CandidateDiag,
9935  bool Complain = true, QualType TargetType = QualType());
9936 
9937  ///@}
9938 
9939  //
9940  //
9941  // -------------------------------------------------------------------------
9942  //
9943  //
9944 
9945  /// \name C++ Template Instantiation
9946  /// Implementations are in SemaTemplateInstantiate.cpp
9947  ///@{
9948 
9949 public:
9950  /// A helper class for building up ExtParameterInfos.
9953  bool HasInteresting = false;
9954 
9955  public:
9956  /// Set the ExtParameterInfo for the parameter at the given index,
9957  ///
9958  void set(unsigned index, FunctionProtoType::ExtParameterInfo info) {
9959  assert(Infos.size() <= index);
9960  Infos.resize(index);
9961  Infos.push_back(info);
9962 
9963  if (!HasInteresting)
9964  HasInteresting = (info != FunctionProtoType::ExtParameterInfo());
9965  }
9966 
9967  /// Return a pointer (suitable for setting in an ExtProtoInfo) to the
9968  /// ExtParameterInfo array we've built up.
9970  getPointerOrNull(unsigned numParams) {
9971  if (!HasInteresting)
9972  return nullptr;
9973  Infos.resize(numParams);
9974  return Infos.data();
9975  }
9976  };
9977 
9978  /// The current instantiation scope used to store local
9979  /// variables.
9981 
9982  typedef llvm::DenseMap<ParmVarDecl *, llvm::TinyPtrVector<ParmVarDecl *>>
9984 
9985  /// A mapping from parameters with unparsed default arguments to the
9986  /// set of instantiations of each parameter.
9987  ///
9988  /// This mapping is a temporary data structure used when parsing
9989  /// nested class templates or nested classes of class templates,
9990  /// where we might end up instantiating an inner class before the
9991  /// default arguments of its methods have been parsed.
9993 
9994  /// A context in which code is being synthesized (where a source location
9995  /// alone is not sufficient to identify the context). This covers template
9996  /// instantiation and various forms of implicitly-generated functions.
9998  /// The kind of template instantiation we are performing
10000  /// We are instantiating a template declaration. The entity is
10001  /// the declaration we're instantiating (e.g., a CXXRecordDecl).
10003 
10004  /// We are instantiating a default argument for a template
10005  /// parameter. The Entity is the template parameter whose argument is
10006  /// being instantiated, the Template is the template, and the
10007  /// TemplateArgs/NumTemplateArguments provide the template arguments as
10008  /// specified.
10010 
10011  /// We are instantiating a default argument for a function.
10012  /// The Entity is the ParmVarDecl, and TemplateArgs/NumTemplateArgs
10013  /// provides the template arguments as specified.
10015 
10016  /// We are substituting explicit template arguments provided for
10017  /// a function template. The entity is a FunctionTemplateDecl.
10019 
10020  /// We are substituting template argument determined as part of
10021  /// template argument deduction for either a class template
10022  /// partial specialization or a function template. The
10023  /// Entity is either a {Class|Var}TemplatePartialSpecializationDecl or
10024  /// a TemplateDecl.
10026 
10027  /// We are substituting into a lambda expression.
10029 
10030  /// We are substituting prior template arguments into a new
10031  /// template parameter. The template parameter itself is either a
10032  /// NonTypeTemplateParmDecl or a TemplateTemplateParmDecl.
10034 
10035  /// We are checking the validity of a default template argument that
10036  /// has been used when naming a template-id.
10038 
10039  /// We are computing the exception specification for a defaulted special
10040  /// member function.
10042 
10043  /// We are instantiating the exception specification for a function
10044  /// template which was deferred until it was needed.
10046 
10047  /// We are instantiating a requirement of a requires expression.
10049 
10050  /// We are checking the satisfaction of a nested requirement of a requires
10051  /// expression.
10053 
10054  /// We are declaring an implicit special member function.
10056 
10057  /// We are declaring an implicit 'operator==' for a defaulted
10058  /// 'operator<=>'.
10060 
10061  /// We are defining a synthesized function (such as a defaulted special
10062  /// member).
10064 
10065  // We are checking the constraints associated with a constrained entity or
10066  // the constraint expression of a concept. This includes the checks that
10067  // atomic constraints have the type 'bool' and that they can be constant
10068  // evaluated.
10070 
10071  // We are substituting template arguments into a constraint expression.
10073 
10074  // We are normalizing a constraint expression.
10076 
10077  // Instantiating a Requires Expression parameter clause.
10079 
10080  // We are substituting into the parameter mapping of an atomic constraint
10081  // during normalization.
10083 
10084  /// We are rewriting a comparison operator in terms of an operator<=>.
10086 
10087  /// We are initializing a structured binding.
10089 
10090  /// We are marking a class as __dllexport.
10092 
10093  /// We are building an implied call from __builtin_dump_struct. The
10094  /// arguments are in CallArgs.
10096 
10097  /// Added for Template instantiation observation.
10098  /// Memoization means we are _not_ instantiating a template because
10099  /// it is already instantiated (but we entered a context where we
10100  /// would have had to if it was not already instantiated).
10102 
10103  /// We are building deduction guides for a class.
10105 
10106  /// We are instantiating a type alias template declaration.
10108  } Kind;
10109 
10110  /// Was the enclosing context a non-instantiation SFINAE context?
10112 
10113  /// The point of instantiation or synthesis within the source code.
10115 
10116  /// The entity that is being synthesized.
10118 
10119  /// The template (or partial specialization) in which we are
10120  /// performing the instantiation, for substitutions of prior template
10121  /// arguments.
10123 
10124  union {
10125  /// The list of template arguments we are substituting, if they
10126  /// are not part of the entity.
10128 
10129  /// The list of argument expressions in a synthesized call.
10130  const Expr *const *CallArgs;
10131  };
10132 
10133  // FIXME: Wrap this union around more members, or perhaps store the
10134  // kind-specific members in the RAII object owning the context.
10135  union {
10136  /// The number of template arguments in TemplateArgs.
10138 
10139  /// The number of expressions in CallArgs.
10140  unsigned NumCallArgs;
10141 
10142  /// The special member being declared or defined.
10144  };
10145 
10147  assert(Kind != DeclaringSpecialMember);
10148  return {TemplateArgs, NumTemplateArgs};
10149  }
10150 
10151  /// The template deduction info object associated with the
10152  /// substitution or checking of explicit or deduced template arguments.
10154 
10155  /// The source range that covers the construct that cause
10156  /// the instantiation, e.g., the template-id that causes a class
10157  /// template instantiation.
10159 
10161  : Kind(TemplateInstantiation),
10162  SavedInNonInstantiationSFINAEContext(false), Entity(nullptr),
10163  Template(nullptr), TemplateArgs(nullptr), NumTemplateArgs(0),
10164  DeductionInfo(nullptr) {}
10165 
10166  /// Determines whether this template is an actual instantiation
10167  /// that should be counted toward the maximum instantiation depth.
10168  bool isInstantiationRecord() const;
10169  };
10170 
10171  /// A stack object to be created when performing template
10172  /// instantiation.
10173  ///
10174  /// Construction of an object of type \c InstantiatingTemplate
10175  /// pushes the current instantiation onto the stack of active
10176  /// instantiations. If the size of this stack exceeds the maximum
10177  /// number of recursive template instantiations, construction
10178  /// produces an error and evaluates true.
10179  ///
10180  /// Destruction of this object will pop the named instantiation off
10181  /// the stack.
10183  /// Note that we are instantiating a class template,
10184  /// function template, variable template, alias template,
10185  /// or a member thereof.
10186  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10187  Decl *Entity,
10188  SourceRange InstantiationRange = SourceRange());
10189 
10191  /// Note that we are instantiating an exception specification
10192  /// of a function template.
10193  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10195  SourceRange InstantiationRange = SourceRange());
10196 
10197  /// Note that we are instantiating a type alias template declaration.
10198  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10199  TypeAliasTemplateDecl *Entity,
10200  ArrayRef<TemplateArgument> TemplateArgs,
10201  SourceRange InstantiationRange = SourceRange());
10202 
10203  /// Note that we are instantiating a default argument in a
10204  /// template-id.
10205  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10206  TemplateParameter Param, TemplateDecl *Template,
10207  ArrayRef<TemplateArgument> TemplateArgs,
10208  SourceRange InstantiationRange = SourceRange());
10209 
10210  /// Note that we are substituting either explicitly-specified or
10211  /// deduced template arguments during function template argument deduction.
10212  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10213  FunctionTemplateDecl *FunctionTemplate,
10214  ArrayRef<TemplateArgument> TemplateArgs,
10216  sema::TemplateDeductionInfo &DeductionInfo,
10217  SourceRange InstantiationRange = SourceRange());
10218 
10219  /// Note that we are instantiating as part of template
10220  /// argument deduction for a class template declaration.
10221  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10222  TemplateDecl *Template,
10223  ArrayRef<TemplateArgument> TemplateArgs,
10224  sema::TemplateDeductionInfo &DeductionInfo,
10225  SourceRange InstantiationRange = SourceRange());
10226 
10227  /// Note that we are instantiating as part of template
10228  /// argument deduction for a class template partial
10229  /// specialization.
10230  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10232  ArrayRef<TemplateArgument> TemplateArgs,
10233  sema::TemplateDeductionInfo &DeductionInfo,
10234  SourceRange InstantiationRange = SourceRange());
10235 
10236  /// Note that we are instantiating as part of template
10237  /// argument deduction for a variable template partial
10238  /// specialization.
10239  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10241  ArrayRef<TemplateArgument> TemplateArgs,
10242  sema::TemplateDeductionInfo &DeductionInfo,
10243  SourceRange InstantiationRange = SourceRange());
10244 
10245  /// Note that we are instantiating a default argument for a function
10246  /// parameter.
10247  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10248  ParmVarDecl *Param,
10249  ArrayRef<TemplateArgument> TemplateArgs,
10250  SourceRange InstantiationRange = SourceRange());
10251 
10252  /// Note that we are substituting prior template arguments into a
10253  /// non-type parameter.
10254  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10255  NamedDecl *Template, NonTypeTemplateParmDecl *Param,
10256  ArrayRef<TemplateArgument> TemplateArgs,
10257  SourceRange InstantiationRange);
10258 
10259  /// Note that we are substituting prior template arguments into a
10260  /// template template parameter.
10261  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10262  NamedDecl *Template, TemplateTemplateParmDecl *Param,
10263  ArrayRef<TemplateArgument> TemplateArgs,
10264  SourceRange InstantiationRange);
10265 
10266  /// Note that we are checking the default template argument
10267  /// against the template parameter for a given template-id.
10268  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10269  TemplateDecl *Template, NamedDecl *Param,
10270  ArrayRef<TemplateArgument> TemplateArgs,
10271  SourceRange InstantiationRange);
10272 
10273  struct ConstraintsCheck {};
10274  /// \brief Note that we are checking the constraints associated with some
10275  /// constrained entity (a concept declaration or a template with associated
10276  /// constraints).
10277  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10278  ConstraintsCheck, NamedDecl *Template,
10279  ArrayRef<TemplateArgument> TemplateArgs,
10280  SourceRange InstantiationRange);
10281 
10283  /// \brief Note that we are checking a constraint expression associated
10284  /// with a template declaration or as part of the satisfaction check of a
10285  /// concept.
10286  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10287  ConstraintSubstitution, NamedDecl *Template,
10288  sema::TemplateDeductionInfo &DeductionInfo,
10289  SourceRange InstantiationRange);
10290 
10292  /// \brief Note that we are normalizing a constraint expression.
10293  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10295  SourceRange InstantiationRange);
10296 
10298  /// \brief Note that we are subtituting into the parameter mapping of an
10299  /// atomic constraint during constraint normalization.
10300  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10302  SourceRange InstantiationRange);
10303 
10304  /// \brief Note that we are substituting template arguments into a part of
10305  /// a requirement of a requires expression.
10306  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10307  concepts::Requirement *Req,
10308  sema::TemplateDeductionInfo &DeductionInfo,
10309  SourceRange InstantiationRange = SourceRange());
10310 
10311  /// \brief Note that we are checking the satisfaction of the constraint
10312  /// expression inside of a nested requirement.
10313  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10315  SourceRange InstantiationRange = SourceRange());
10316 
10317  /// \brief Note that we are checking a requires clause.
10318  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10319  const RequiresExpr *E,
10320  sema::TemplateDeductionInfo &DeductionInfo,
10321  SourceRange InstantiationRange);
10322 
10324  /// \brief Note that we are building deduction guides.
10325  InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
10327  SourceRange InstantiationRange = SourceRange());
10328 
10329  /// Note that we have finished instantiating this template.
10330  void Clear();
10331 
10332  ~InstantiatingTemplate() { Clear(); }
10333 
10334  /// Determines whether we have exceeded the maximum
10335  /// recursive template instantiations.
10336  bool isInvalid() const { return Invalid; }
10337 
10338  /// Determine whether we are already instantiating this
10339  /// specialization in some surrounding active instantiation.
10340  bool isAlreadyInstantiating() const { return AlreadyInstantiating; }
10341 
10342  private:
10343  Sema &SemaRef;
10344  bool Invalid;
10345  bool AlreadyInstantiating;
10346  bool CheckInstantiationDepth(SourceLocation PointOfInstantiation,
10347  SourceRange InstantiationRange);
10348 
10351  SourceLocation PointOfInstantiation, SourceRange InstantiationRange,
10352  Decl *Entity, NamedDecl *Template = nullptr,
10353  ArrayRef<TemplateArgument> TemplateArgs = std::nullopt,
10354  sema::TemplateDeductionInfo *DeductionInfo = nullptr);
10355 
10356  InstantiatingTemplate(const InstantiatingTemplate &) = delete;
10357 
10358  InstantiatingTemplate &operator=(const InstantiatingTemplate &) = delete;
10359  };
10360 
10361  bool SubstTemplateArgument(const TemplateArgumentLoc &Input,
10362  const MultiLevelTemplateArgumentList &TemplateArgs,
10363  TemplateArgumentLoc &Output);
10364  bool
10366  const MultiLevelTemplateArgumentList &TemplateArgs,
10367  TemplateArgumentListInfo &Outputs);
10368 
10370  const NamedDecl *D, const DeclContext *DC = nullptr, bool Final = false,
10371  std::optional<ArrayRef<TemplateArgument>> Innermost = std::nullopt,
10372  bool RelativeToPrimary = false, const FunctionDecl *Pattern = nullptr,
10373  bool ForConstraintInstantiation = false,
10374  bool SkipForSpecialization = false);
10375 
10376  /// RAII object to handle the state changes required to synthesize
10377  /// a function body.
10379  Sema &S;
10380  Sema::ContextRAII SavedContext;
10381  bool PushedCodeSynthesisContext = false;
10382 
10383  public:
10385  : S(S), SavedContext(S, DC) {
10386  auto *FD = dyn_cast<FunctionDecl>(DC);
10387  S.PushFunctionScope();
10388  S.PushExpressionEvaluationContext(
10389  (FD && FD->isConsteval())
10392  if (FD) {
10393  FD->setWillHaveBody(true);
10394  S.ExprEvalContexts.back().InImmediateFunctionContext =
10395  FD->isImmediateFunction() ||
10396  S.ExprEvalContexts[S.ExprEvalContexts.size() - 2]
10397  .isConstantEvaluated();
10398  S.ExprEvalContexts.back().InImmediateEscalatingFunctionContext =
10399  S.getLangOpts().CPlusPlus20 && FD->isImmediateEscalating();
10400  } else
10401  assert(isa<ObjCMethodDecl>(DC));
10402  }
10403 
10405  assert(!PushedCodeSynthesisContext);
10406 
10409  Ctx.PointOfInstantiation = UseLoc;
10410  Ctx.Entity = cast<Decl>(S.CurContext);
10411  S.pushCodeSynthesisContext(Ctx);
10412 
10413  PushedCodeSynthesisContext = true;
10414  }
10415 
10417  if (PushedCodeSynthesisContext)
10418  S.popCodeSynthesisContext();
10419  if (auto *FD = dyn_cast<FunctionDecl>(S.CurContext)) {
10420  FD->setWillHaveBody(false);
10421  S.CheckImmediateEscalatingFunctionDefinition(FD, S.getCurFunction());
10422  }
10423  S.PopExpressionEvaluationContext();
10424  S.PopFunctionScopeInfo();
10425  }
10426  };
10427 
10428  /// List of active code synthesis contexts.
10429  ///
10430  /// This vector is treated as a stack. As synthesis of one entity requires
10431  /// synthesis of another, additional contexts are pushed onto the stack.
10433 
10434  /// Specializations whose definitions are currently being instantiated.
10436 
10437  /// Non-dependent types used in templates that have already been instantiated
10438  /// by some template instantiation.
10440 
10441  /// Extra modules inspected when performing a lookup during a template
10442  /// instantiation. Computed lazily.
10444 
10445  /// Cache of additional modules that should be used for name lookup
10446  /// within the current template instantiation. Computed lazily; use
10447  /// getLookupModules() to get a complete set.
10449 
10450  /// Map from the most recent declaration of a namespace to the most
10451  /// recent visible declaration of that namespace.
10452  llvm::DenseMap<NamedDecl *, NamedDecl *> VisibleNamespaceCache;
10453 
10454  /// Whether we are in a SFINAE context that is not associated with
10455  /// template instantiation.
10456  ///
10457  /// This is used when setting up a SFINAE trap (\c see SFINAETrap) outside
10458  /// of a template instantiation or template argument deduction.
10460 
10461  /// The number of \p CodeSynthesisContexts that are not template
10462  /// instantiations and, therefore, should not be counted as part of the
10463  /// instantiation depth.
10464  ///
10465  /// When the instantiation depth reaches the user-configurable limit
10466  /// \p LangOptions::InstantiationDepth we will abort instantiation.
10467  // FIXME: Should we have a similar limit for other forms of synthesis?
10469 
10470  /// The depth of the context stack at the point when the most recent
10471  /// error or warning was produced.
10472  ///
10473  /// This value is used to suppress printing of redundant context stacks
10474  /// when there are multiple errors or warnings in the same instantiation.
10475  // FIXME: Does this belong in Sema? It's tough to implement it anywhere else.
10477 
10478  /// The template instantiation callbacks to trace or track
10479  /// instantiations (objects can be chained).
10480  ///
10481  /// This callbacks is used to print, trace or track template
10482  /// instantiations as they are being constructed.
10483  std::vector<std::unique_ptr<TemplateInstantiationCallback>>
10485 
10486  /// The current index into pack expansion arguments that will be
10487  /// used for substitution of parameter packs.
10488  ///
10489  /// The pack expansion index will be -1 to indicate that parameter packs
10490  /// should be instantiated as themselves. Otherwise, the index specifies
10491  /// which argument within the parameter pack will be used for substitution.
10493 
10494  /// RAII object used to change the argument pack substitution index
10495  /// within a \c Sema object.
10496  ///
10497  /// See \c ArgumentPackSubstitutionIndex for more information.
10499  Sema &Self;
10500  int OldSubstitutionIndex;
10501 
10502  public:
10503  ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex)
10504  : Self(Self), OldSubstitutionIndex(Self.ArgumentPackSubstitutionIndex) {
10505  Self.ArgumentPackSubstitutionIndex = NewSubstitutionIndex;
10506  }
10507 
10509  Self.ArgumentPackSubstitutionIndex = OldSubstitutionIndex;
10510  }
10511  };
10512 
10514 
10516  void popCodeSynthesisContext();
10517 
10519  if (!CodeSynthesisContexts.empty() &&
10523  }
10526  }
10527  void PrintInstantiationStack();
10528 
10529  /// Determines whether we are currently in a context where
10530  /// template argument substitution failures are not considered
10531  /// errors.
10532  ///
10533  /// \returns An empty \c Optional if we're not in a SFINAE context.
10534  /// Otherwise, contains a pointer that, if non-NULL, contains the nearest
10535  /// template-deduction context object, which can be used to capture
10536  /// diagnostics that will be suppressed.
10537  std::optional<sema::TemplateDeductionInfo *> isSFINAEContext() const;
10538 
10540  const MultiLevelTemplateArgumentList &TemplateArgs,
10541  SourceLocation Loc, DeclarationName Entity,
10542  bool AllowDeducedTST = false);
10543 
10545  const MultiLevelTemplateArgumentList &TemplateArgs,
10546  SourceLocation Loc, DeclarationName Entity);
10547 
10549  const MultiLevelTemplateArgumentList &TemplateArgs,
10550  SourceLocation Loc, DeclarationName Entity);
10551 
10553  TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs,
10554  SourceLocation Loc, DeclarationName Entity, CXXRecordDecl *ThisContext,
10555  Qualifiers ThisTypeQuals, bool EvaluateConstraints = true);
10556  void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto,
10557  const MultiLevelTemplateArgumentList &Args);
10560  SmallVectorImpl<QualType> &ExceptionStorage,
10561  const MultiLevelTemplateArgumentList &Args);
10562  ParmVarDecl *
10564  const MultiLevelTemplateArgumentList &TemplateArgs,
10565  int indexAdjustment, std::optional<unsigned> NumExpansions,
10566  bool ExpectParameterPack, bool EvaluateConstraints = true);
10568  const FunctionProtoType::ExtParameterInfo *ExtParamInfos,
10569  const MultiLevelTemplateArgumentList &TemplateArgs,
10570  SmallVectorImpl<QualType> &ParamTypes,
10571  SmallVectorImpl<ParmVarDecl *> *OutParams,
10572  ExtParameterInfoBuilder &ParamInfos);
10574  const MultiLevelTemplateArgumentList &TemplateArgs,
10575  bool ForCallExpr = false);
10577  const MultiLevelTemplateArgumentList &TemplateArgs);
10578 
10579  // A RAII type used by the TemplateDeclInstantiator and TemplateInstantiator
10580  // to disable constraint evaluation, then restore the state.
10581  template <typename InstTy> struct ConstraintEvalRAII {
10582  InstTy &TI;
10583  bool OldValue;
10584 
10586  : TI(TI), OldValue(TI.getEvaluateConstraints()) {
10587  TI.setEvaluateConstraints(false);
10588  }
10589  ~ConstraintEvalRAII() { TI.setEvaluateConstraints(OldValue); }
10590  };
10591 
10592  // Must be used instead of SubstExpr at 'constraint checking' time.
10593  ExprResult
10595  const MultiLevelTemplateArgumentList &TemplateArgs);
10596  // Unlike the above, this does not evaluates constraints.
10598  Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs);
10599 
10600  /// Substitute the given template arguments into a list of
10601  /// expressions, expanding pack expansions if required.
10602  ///
10603  /// \param Exprs The list of expressions to substitute into.
10604  ///
10605  /// \param IsCall Whether this is some form of call, in which case
10606  /// default arguments will be dropped.
10607  ///
10608  /// \param TemplateArgs The set of template arguments to substitute.
10609  ///
10610  /// \param Outputs Will receive all of the substituted arguments.
10611  ///
10612  /// \returns true if an error occurred, false otherwise.
10613  bool SubstExprs(ArrayRef<Expr *> Exprs, bool IsCall,
10614  const MultiLevelTemplateArgumentList &TemplateArgs,
10615  SmallVectorImpl<Expr *> &Outputs);
10616 
10618  const MultiLevelTemplateArgumentList &TemplateArgs);
10619 
10620  ExprResult
10621  SubstInitializer(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs,
10622  bool CXXDirectInit);
10623 
10624  bool SubstBaseSpecifiers(CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern,
10625  const MultiLevelTemplateArgumentList &TemplateArgs);
10626 
10627  bool InstantiateClass(SourceLocation PointOfInstantiation,
10628  CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern,
10629  const MultiLevelTemplateArgumentList &TemplateArgs,
10630  TemplateSpecializationKind TSK, bool Complain = true);
10631 
10632  bool InstantiateEnum(SourceLocation PointOfInstantiation,
10633  EnumDecl *Instantiation, EnumDecl *Pattern,
10634  const MultiLevelTemplateArgumentList &TemplateArgs,
10636 
10638  SourceLocation PointOfInstantiation, FieldDecl *Instantiation,
10639  FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs);
10640 
10642  SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec);
10643 
10645  SourceLocation PointOfInstantiation,
10646  ClassTemplateSpecializationDecl *ClassTemplateSpec,
10647  TemplateSpecializationKind TSK, bool Complain = true);
10648 
10649  void
10650  InstantiateClassMembers(SourceLocation PointOfInstantiation,
10651  CXXRecordDecl *Instantiation,
10652  const MultiLevelTemplateArgumentList &TemplateArgs,
10654 
10656  SourceLocation PointOfInstantiation,
10657  ClassTemplateSpecializationDecl *ClassTemplateSpec,
10659 
10662  const MultiLevelTemplateArgumentList &TemplateArgs);
10663 
10666  const MultiLevelTemplateArgumentList &TemplateArgs);
10667  TemplateName
10669  SourceLocation Loc,
10670  const MultiLevelTemplateArgumentList &TemplateArgs);
10671 
10673  const MultiLevelTemplateArgumentList &TemplateArgs,
10674  bool EvaluateConstraint);
10675 
10676  /// Determine whether we are currently performing template instantiation.
10679  }
10680 
10681  ///@}
10682 
10683  //
10684  //
10685  // -------------------------------------------------------------------------
10686  //
10687  //
10688 
10689  /// \name C++ Template Declaration Instantiation
10690  /// Implementations are in SemaTemplateInstantiateDecl.cpp
10691  ///@{
10692 
10693 public:
10694  /// An entity for which implicit template instantiation is required.
10695  ///
10696  /// The source location associated with the declaration is the first place in
10697  /// the source code where the declaration was "used". It is not necessarily
10698  /// the point of instantiation (which will be either before or after the
10699  /// namespace-scope declaration that triggered this implicit instantiation),
10700  /// However, it is the location that diagnostics should generally refer to,
10701  /// because users will need to know what code triggered the instantiation.
10702  typedef std::pair<ValueDecl *, SourceLocation> PendingImplicitInstantiation;
10703 
10704  /// The queue of implicit template instantiations that are required
10705  /// but have not yet been performed.
10706  std::deque<PendingImplicitInstantiation> PendingInstantiations;
10707 
10708  /// Queue of implicit template instantiations that cannot be performed
10709  /// eagerly.
10711 
10715 
10716  /// The queue of implicit template instantiations that are required
10717  /// and must be performed within the current local scope.
10718  ///
10719  /// This queue is only used for member functions of local classes in
10720  /// templates, which must be instantiated in the same scope as their
10721  /// enclosing function, so that they can reference function-local
10722  /// types, static variables, enumerators, etc.
10723  std::deque<PendingImplicitInstantiation> PendingLocalImplicitInstantiations;
10724 
10726  public:
10728  SavedPendingLocalImplicitInstantiations.swap(
10729  S.PendingLocalImplicitInstantiations);
10730  }
10731 
10732  void perform() { S.PerformPendingInstantiations(/*LocalOnly=*/true); }
10733 
10735  assert(S.PendingLocalImplicitInstantiations.empty() &&
10736  "there shouldn't be any pending local implicit instantiations");
10737  SavedPendingLocalImplicitInstantiations.swap(
10738  S.PendingLocalImplicitInstantiations);
10739  }
10740 
10741  private:
10742  Sema &S;
10743  std::deque<PendingImplicitInstantiation>
10744  SavedPendingLocalImplicitInstantiations;
10745  };
10746 
10747  /// Records and restores the CurFPFeatures state on entry/exit of compound
10748  /// statements.
10750  public:
10753  FPOptionsOverride getOverrides() { return OldOverrides; }
10754 
10755  private:
10756  Sema &S;
10757  FPOptions OldFPFeaturesState;
10758  FPOptionsOverride OldOverrides;
10759  LangOptions::FPEvalMethodKind OldEvalMethod;
10760  SourceLocation OldFPPragmaLocation;
10761  };
10762 
10764  public:
10766  : S(S), Enabled(Enabled) {
10767  if (!Enabled)
10768  return;
10769 
10770  S.SavedPendingInstantiations.emplace_back();
10771  S.SavedPendingInstantiations.back().swap(S.PendingInstantiations);
10772 
10773  S.SavedVTableUses.emplace_back();
10774  S.SavedVTableUses.back().swap(S.VTableUses);
10775  }
10776 
10777  void perform() {
10778  if (Enabled) {
10779  S.DefineUsedVTables();
10780  S.PerformPendingInstantiations();
10781  }
10782  }
10783 
10785  if (!Enabled)
10786  return;
10787 
10788  // Restore the set of pending vtables.
10789  assert(S.VTableUses.empty() &&
10790  "VTableUses should be empty before it is discarded.");
10791  S.VTableUses.swap(S.SavedVTableUses.back());
10792  S.SavedVTableUses.pop_back();
10793 
10794  // Restore the set of pending implicit instantiations.
10795  if (S.TUKind != TU_Prefix || !S.LangOpts.PCHInstantiateTemplates) {
10796  assert(S.PendingInstantiations.empty() &&
10797  "PendingInstantiations should be empty before it is discarded.");
10798  S.PendingInstantiations.swap(S.SavedPendingInstantiations.back());
10799  S.SavedPendingInstantiations.pop_back();
10800  } else {
10801  // Template instantiations in the PCH may be delayed until the TU.
10802  S.PendingInstantiations.swap(S.SavedPendingInstantiations.back());
10803  S.PendingInstantiations.insert(
10804  S.PendingInstantiations.end(),
10805  S.SavedPendingInstantiations.back().begin(),
10806  S.SavedPendingInstantiations.back().end());
10807  S.SavedPendingInstantiations.pop_back();
10808  }
10809  }
10810 
10811  private:
10812  Sema &S;
10813  bool Enabled;
10814  };
10815 
10817  const MultiLevelTemplateArgumentList &TemplateArgs, ExplicitSpecifier ES);
10818 
10820  const Attr *TmplAttr;
10823 
10825  Decl *D)
10826  : TmplAttr(A), Scope(S), NewDecl(D) {}
10827  };
10829 
10830  void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
10831  const Decl *Pattern, Decl *Inst,
10832  LateInstantiatedAttrVec *LateAttrs = nullptr,
10833  LocalInstantiationScope *OuterMostScope = nullptr);
10834  void updateAttrsForLateParsedTemplate(const Decl *Pattern, Decl *Inst);
10835 
10836  void
10838  const Decl *Pattern, Decl *Inst,
10839  LateInstantiatedAttrVec *LateAttrs = nullptr,
10840  LocalInstantiationScope *OuterMostScope = nullptr);
10841 
10843 
10845  ParmVarDecl *Param);
10846  void InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
10847  FunctionDecl *Function);
10849  FunctionTemplateDecl *FTD, const TemplateArgumentList *Args,
10850  SourceLocation Loc,
10853  void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
10854  FunctionDecl *Function,
10855  bool Recursive = false,
10856  bool DefinitionRequired = false,
10857  bool AtEndOfTU = false);
10859  VarTemplateDecl *VarTemplate, VarDecl *FromVar,
10860  const TemplateArgumentList *PartialSpecArgs,
10861  const TemplateArgumentListInfo &TemplateArgsInfo,
10863  SourceLocation PointOfInstantiation,
10864  LateInstantiatedAttrVec *LateAttrs = nullptr,
10865  LocalInstantiationScope *StartingScope = nullptr);
10867  VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl,
10868  const MultiLevelTemplateArgumentList &TemplateArgs);
10869  void
10870  BuildVariableInstantiation(VarDecl *NewVar, VarDecl *OldVar,
10871  const MultiLevelTemplateArgumentList &TemplateArgs,
10872  LateInstantiatedAttrVec *LateAttrs,
10873  DeclContext *Owner,
10874  LocalInstantiationScope *StartingScope,
10875  bool InstantiatingVarTemplate = false,
10876  VarTemplateSpecializationDecl *PrevVTSD = nullptr);
10877 
10879  VarDecl *Var, VarDecl *OldVar,
10880  const MultiLevelTemplateArgumentList &TemplateArgs);
10881  void InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
10882  VarDecl *Var, bool Recursive = false,
10883  bool DefinitionRequired = false,
10884  bool AtEndOfTU = false);
10885 
10887  CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl,
10888  const MultiLevelTemplateArgumentList &TemplateArgs);
10889 
10890  NamedDecl *
10892  const MultiLevelTemplateArgumentList &TemplateArgs,
10893  bool FindingInstantiatedContext = false);
10894  DeclContext *
10896  const MultiLevelTemplateArgumentList &TemplateArgs);
10897 
10898  Decl *SubstDecl(Decl *D, DeclContext *Owner,
10899  const MultiLevelTemplateArgumentList &TemplateArgs);
10900 
10901  /// Substitute the name and return type of a defaulted 'operator<=>' to form
10902  /// an implicit 'operator=='.
10905 
10906  void PerformPendingInstantiations(bool LocalOnly = false);
10907 
10910  const MultiLevelTemplateArgumentList &TemplateArgs,
10911  bool EvaluateConstraints = true);
10912 
10914  const DeclContext *Pattern,
10915  const MultiLevelTemplateArgumentList &TemplateArgs);
10916 
10917 private:
10918  /// Introduce the instantiated local variables into the local
10919  /// instantiation scope.
10920  void addInstantiatedLocalVarsToScope(FunctionDecl *Function,
10921  const FunctionDecl *PatternDecl,
10923  /// Introduce the instantiated function parameters into the local
10924  /// instantiation scope, and set the parameter names to those used
10925  /// in the template.
10926  bool addInstantiatedParametersToScope(
10927  FunctionDecl *Function, const FunctionDecl *PatternDecl,
10929  const MultiLevelTemplateArgumentList &TemplateArgs);
10930 
10931  int ParsingClassDepth = 0;
10932 
10933  class SavePendingParsedClassStateRAII {
10934  public:
10935  SavePendingParsedClassStateRAII(Sema &S) : S(S) { swapSavedState(); }
10936 
10937  ~SavePendingParsedClassStateRAII() {
10938  assert(S.DelayedOverridingExceptionSpecChecks.empty() &&
10939  "there shouldn't be any pending delayed exception spec checks");
10940  assert(S.DelayedEquivalentExceptionSpecChecks.empty() &&
10941  "there shouldn't be any pending delayed exception spec checks");
10942  swapSavedState();
10943  }
10944 
10945  private:
10946  Sema &S;
10948  SavedOverridingExceptionSpecChecks;
10950  SavedEquivalentExceptionSpecChecks;
10951 
10952  void swapSavedState() {
10953  SavedOverridingExceptionSpecChecks.swap(
10954  S.DelayedOverridingExceptionSpecChecks);
10955  SavedEquivalentExceptionSpecChecks.swap(
10956  S.DelayedEquivalentExceptionSpecChecks);
10957  }
10958  };
10959 
10960  ///@}
10961 
10962  //
10963  //
10964  // -------------------------------------------------------------------------
10965  //
10966  //
10967 
10968  /// \name C++ Variadic Templates
10969  /// Implementations are in SemaTemplateVariadic.cpp
10970  ///@{
10971 
10972 public:
10973  /// Determine whether an unexpanded parameter pack might be permitted in this
10974  /// location. Useful for error recovery.
10976 
10977  /// The context in which an unexpanded parameter pack is
10978  /// being diagnosed.
10979  ///
10980  /// Note that the values of this enumeration line up with the first
10981  /// argument to the \c err_unexpanded_parameter_pack diagnostic.
10983  /// An arbitrary expression.
10985 
10986  /// The base type of a class type.
10988 
10989  /// The type of an arbitrary declaration.
10991 
10992  /// The type of a data member.
10994 
10995  /// The size of a bit-field.
10997 
10998  /// The expression in a static assertion.
11000 
11001  /// The fixed underlying type of an enumeration.
11003 
11004  /// The enumerator value.
11006 
11007  /// A using declaration.
11009 
11010  /// A friend declaration.
11012 
11013  /// A declaration qualifier.
11015 
11016  /// An initializer.
11018 
11019  /// A default argument.
11021 
11022  /// The type of a non-type template parameter.
11024 
11025  /// The type of an exception.
11027 
11028  /// Explicit specialization.
11030 
11031  /// Partial specialization.
11033 
11034  /// Microsoft __if_exists.
11036 
11037  /// Microsoft __if_not_exists.
11039 
11040  /// Lambda expression.
11042 
11043  /// Block expression.
11045 
11046  /// A type constraint.
11048 
11049  // A requirement in a requires-expression.
11051 
11052  // A requires-clause.
11054  };
11055 
11056  /// Diagnose unexpanded parameter packs.
11057  ///
11058  /// \param Loc The location at which we should emit the diagnostic.
11059  ///
11060  /// \param UPPC The context in which we are diagnosing unexpanded
11061  /// parameter packs.
11062  ///
11063  /// \param Unexpanded the set of unexpanded parameter packs.
11064  ///
11065  /// \returns true if an error occurred, false otherwise.
11069 
11070  /// If the given type contains an unexpanded parameter pack,
11071  /// diagnose the error.
11072  ///
11073  /// \param Loc The source location where a diagnostc should be emitted.
11074  ///
11075  /// \param T The type that is being checked for unexpanded parameter
11076  /// packs.
11077  ///
11078  /// \returns true if an error occurred, false otherwise.
11081 
11082  /// If the given expression contains an unexpanded parameter
11083  /// pack, diagnose the error.
11084  ///
11085  /// \param E The expression that is being checked for unexpanded
11086  /// parameter packs.
11087  ///
11088  /// \returns true if an error occurred, false otherwise.
11091 
11092  /// If the given requirees-expression contains an unexpanded reference to one
11093  /// of its own parameter packs, diagnose the error.
11094  ///
11095  /// \param RE The requiress-expression that is being checked for unexpanded
11096  /// parameter packs.
11097  ///
11098  /// \returns true if an error occurred, false otherwise.
11100 
11101  /// If the given nested-name-specifier contains an unexpanded
11102  /// parameter pack, diagnose the error.
11103  ///
11104  /// \param SS The nested-name-specifier that is being checked for
11105  /// unexpanded parameter packs.
11106  ///
11107  /// \returns true if an error occurred, false otherwise.
11110 
11111  /// If the given name contains an unexpanded parameter pack,
11112  /// diagnose the error.
11113  ///
11114  /// \param NameInfo The name (with source location information) that
11115  /// is being checked for unexpanded parameter packs.
11116  ///
11117  /// \returns true if an error occurred, false otherwise.
11120 
11121  /// If the given template name contains an unexpanded parameter pack,
11122  /// diagnose the error.
11123  ///
11124  /// \param Loc The location of the template name.
11125  ///
11126  /// \param Template The template name that is being checked for unexpanded
11127  /// parameter packs.
11128  ///
11129  /// \returns true if an error occurred, false otherwise.
11131  TemplateName Template,
11133 
11134  /// If the given template argument contains an unexpanded parameter
11135  /// pack, diagnose the error.
11136  ///
11137  /// \param Arg The template argument that is being checked for unexpanded
11138  /// parameter packs.
11139  ///
11140  /// \returns true if an error occurred, false otherwise.
11143 
11144  /// Collect the set of unexpanded parameter packs within the given
11145  /// template argument.
11146  ///
11147  /// \param Arg The template argument that will be traversed to find
11148  /// unexpanded parameter packs.
11150  TemplateArgument Arg,
11152 
11153  /// Collect the set of unexpanded parameter packs within the given
11154  /// template argument.
11155  ///
11156  /// \param Arg The template argument that will be traversed to find
11157  /// unexpanded parameter packs.
11159  TemplateArgumentLoc Arg,
11161 
11162  /// Collect the set of unexpanded parameter packs within the given
11163  /// type.
11164  ///
11165  /// \param T The type that will be traversed to find
11166  /// unexpanded parameter packs.
11169 
11170  /// Collect the set of unexpanded parameter packs within the given
11171  /// type.
11172  ///
11173  /// \param TL The type that will be traversed to find
11174  /// unexpanded parameter packs.
11177 
11178  /// Collect the set of unexpanded parameter packs within the given
11179  /// nested-name-specifier.
11180  ///
11181  /// \param NNS The nested-name-specifier that will be traversed to find
11182  /// unexpanded parameter packs.
11186 
11187  /// Collect the set of unexpanded parameter packs within the given
11188  /// name.
11189  ///
11190  /// \param NameInfo The name that will be traversed to find
11191  /// unexpanded parameter packs.
11193  const DeclarationNameInfo &NameInfo,
11195 
11196  /// Invoked when parsing a template argument followed by an
11197  /// ellipsis, which creates a pack expansion.
11198  ///
11199  /// \param Arg The template argument preceding the ellipsis, which
11200  /// may already be invalid.
11201  ///
11202  /// \param EllipsisLoc The location of the ellipsis.
11204  SourceLocation EllipsisLoc);
11205 
11206  /// Invoked when parsing a type followed by an ellipsis, which
11207  /// creates a pack expansion.
11208  ///
11209  /// \param Type The type preceding the ellipsis, which will become
11210  /// the pattern of the pack expansion.
11211  ///
11212  /// \param EllipsisLoc The location of the ellipsis.
11214 
11215  /// Construct a pack expansion type from the pattern of the pack
11216  /// expansion.
11218  SourceLocation EllipsisLoc,
11219  std::optional<unsigned> NumExpansions);
11220 
11221  /// Construct a pack expansion type from the pattern of the pack
11222  /// expansion.
11223  QualType CheckPackExpansion(QualType Pattern, SourceRange PatternRange,
11224  SourceLocation EllipsisLoc,
11225  std::optional<unsigned> NumExpansions);
11226 
11227  /// Invoked when parsing an expression followed by an ellipsis, which
11228  /// creates a pack expansion.
11229  ///
11230  /// \param Pattern The expression preceding the ellipsis, which will become
11231  /// the pattern of the pack expansion.
11232  ///
11233  /// \param EllipsisLoc The location of the ellipsis.
11234  ExprResult ActOnPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc);
11235 
11236  /// Invoked when parsing an expression followed by an ellipsis, which
11237  /// creates a pack expansion.
11238  ///
11239  /// \param Pattern The expression preceding the ellipsis, which will become
11240  /// the pattern of the pack expansion.
11241  ///
11242  /// \param EllipsisLoc The location of the ellipsis.
11243  ExprResult CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc,
11244  std::optional<unsigned> NumExpansions);
11245 
11246  /// Determine whether we could expand a pack expansion with the
11247  /// given set of parameter packs into separate arguments by repeatedly
11248  /// transforming the pattern.
11249  ///
11250  /// \param EllipsisLoc The location of the ellipsis that identifies the
11251  /// pack expansion.
11252  ///
11253  /// \param PatternRange The source range that covers the entire pattern of
11254  /// the pack expansion.
11255  ///
11256  /// \param Unexpanded The set of unexpanded parameter packs within the
11257  /// pattern.
11258  ///
11259  /// \param ShouldExpand Will be set to \c true if the transformer should
11260  /// expand the corresponding pack expansions into separate arguments. When
11261  /// set, \c NumExpansions must also be set.
11262  ///
11263  /// \param RetainExpansion Whether the caller should add an unexpanded
11264  /// pack expansion after all of the expanded arguments. This is used
11265  /// when extending explicitly-specified template argument packs per
11266  /// C++0x [temp.arg.explicit]p9.
11267  ///
11268  /// \param NumExpansions The number of separate arguments that will be in
11269  /// the expanded form of the corresponding pack expansion. This is both an
11270  /// input and an output parameter, which can be set by the caller if the
11271  /// number of expansions is known a priori (e.g., due to a prior substitution)
11272  /// and will be set by the callee when the number of expansions is known.
11273  /// The callee must set this value when \c ShouldExpand is \c true; it may
11274  /// set this value in other cases.
11275  ///
11276  /// \returns true if an error occurred (e.g., because the parameter packs
11277  /// are to be instantiated with arguments of different lengths), false
11278  /// otherwise. If false, \c ShouldExpand (and possibly \c NumExpansions)
11279  /// must be set.
11281  SourceLocation EllipsisLoc, SourceRange PatternRange,
11283  const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand,
11284  bool &RetainExpansion, std::optional<unsigned> &NumExpansions);
11285 
11286  /// Determine the number of arguments in the given pack expansion
11287  /// type.
11288  ///
11289  /// This routine assumes that the number of arguments in the expansion is
11290  /// consistent across all of the unexpanded parameter packs in its pattern.
11291  ///
11292  /// Returns an empty Optional if the type can't be expanded.
11293  std::optional<unsigned> getNumArgumentsInExpansion(
11294  QualType T, const MultiLevelTemplateArgumentList &TemplateArgs);
11295 
11296  /// Determine whether the given declarator contains any unexpanded
11297  /// parameter packs.
11298  ///
11299  /// This routine is used by the parser to disambiguate function declarators
11300  /// with an ellipsis prior to the ')', e.g.,
11301  ///
11302  /// \code
11303  /// void f(T...);
11304  /// \endcode
11305  ///
11306  /// To determine whether we have an (unnamed) function parameter pack or
11307  /// a variadic function.
11308  ///
11309  /// \returns true if the declarator contains any unexpanded parameter packs,
11310  /// false otherwise.
11312 
11313  /// Returns the pattern of the pack expansion for a template argument.
11314  ///
11315  /// \param OrigLoc The template argument to expand.
11316  ///
11317  /// \param Ellipsis Will be set to the location of the ellipsis.
11318  ///
11319  /// \param NumExpansions Will be set to the number of expansions that will
11320  /// be generated from this pack expansion, if known a priori.
11322  TemplateArgumentLoc OrigLoc, SourceLocation &Ellipsis,
11323  std::optional<unsigned> &NumExpansions) const;
11324 
11325  /// Given a template argument that contains an unexpanded parameter pack, but
11326  /// which has already been substituted, attempt to determine the number of
11327  /// elements that will be produced once this argument is fully-expanded.
11328  ///
11329  /// This is intended for use when transforming 'sizeof...(Arg)' in order to
11330  /// avoid actually expanding the pack where possible.
11331  std::optional<unsigned> getFullyPackExpandedSize(TemplateArgument Arg);
11332 
11334  IdentifierInfo &Name,
11335  SourceLocation NameLoc,
11336  SourceLocation RParenLoc);
11337 
11338  ExprResult ActOnPackIndexingExpr(Scope *S, Expr *PackExpression,
11339  SourceLocation EllipsisLoc,
11340  SourceLocation LSquareLoc, Expr *IndexExpr,
11341  SourceLocation RSquareLoc);
11342 
11343  ExprResult BuildPackIndexingExpr(Expr *PackExpression,
11344  SourceLocation EllipsisLoc, Expr *IndexExpr,
11345  SourceLocation RSquareLoc,
11346  ArrayRef<Expr *> ExpandedExprs = {},
11347  bool EmptyPack = false);
11348 
11349  /// Handle a C++1z fold-expression: ( expr op ... op expr ).
11350  ExprResult ActOnCXXFoldExpr(Scope *S, SourceLocation LParenLoc, Expr *LHS,
11351  tok::TokenKind Operator,
11352  SourceLocation EllipsisLoc, Expr *RHS,
11353  SourceLocation RParenLoc);
11354  ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee,
11355  SourceLocation LParenLoc, Expr *LHS,
11356  BinaryOperatorKind Operator,
11357  SourceLocation EllipsisLoc, Expr *RHS,
11358  SourceLocation RParenLoc,
11359  std::optional<unsigned> NumExpansions);
11360  ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc,
11361  BinaryOperatorKind Operator);
11362 
11363  ///@}
11364 
11365  //
11366  //
11367  // -------------------------------------------------------------------------
11368  //
11369  //
11370 
11371  /// \name Constraints and Concepts
11372  /// Implementations are in SemaConcept.cpp
11373  ///@{
11374 
11375 public:
11377  const llvm::FoldingSetNodeID &ID) {
11378  const NamedDecl *Can = cast<NamedDecl>(D->getCanonicalDecl());
11379  SatisfactionStack.emplace_back(Can, ID);
11380  }
11381 
11382  void PopSatisfactionStackEntry() { SatisfactionStack.pop_back(); }
11383 
11385  const llvm::FoldingSetNodeID &ID) const {
11386  const NamedDecl *Can = cast<NamedDecl>(D->getCanonicalDecl());
11387  return llvm::find(SatisfactionStack, SatisfactionStackEntryTy{Can, ID}) !=
11388  SatisfactionStack.end();
11389  }
11390 
11392  std::pair<const NamedDecl *, llvm::FoldingSetNodeID>;
11393 
11394  // Resets the current SatisfactionStack for cases where we are instantiating
11395  // constraints as a 'side effect' of normal instantiation in a way that is not
11396  // indicative of recursive definition.
11398  llvm::SmallVector<SatisfactionStackEntryTy, 10> BackupSatisfactionStack;
11399  Sema &SemaRef;
11400 
11401  public:
11403  SemaRef.SwapSatisfactionStack(BackupSatisfactionStack);
11404  }
11405 
11407  SemaRef.SwapSatisfactionStack(BackupSatisfactionStack);
11408  }
11409  };
11410 
11413  SatisfactionStack.swap(NewSS);
11414  }
11415 
11416  /// Check whether the given expression is a valid constraint expression.
11417  /// A diagnostic is emitted if it is not, false is returned, and
11418  /// PossibleNonPrimary will be set to true if the failure might be due to a
11419  /// non-primary expression being used as an atomic constraint.
11420  bool CheckConstraintExpression(const Expr *CE, Token NextToken = Token(),
11421  bool *PossibleNonPrimary = nullptr,
11422  bool IsTrailingRequiresClause = false);
11423 
11424  /// \brief Check whether the given list of constraint expressions are
11425  /// satisfied (as if in a 'conjunction') given template arguments.
11426  /// \param Template the template-like entity that triggered the constraints
11427  /// check (either a concept or a constrained entity).
11428  /// \param ConstraintExprs a list of constraint expressions, treated as if
11429  /// they were 'AND'ed together.
11430  /// \param TemplateArgLists the list of template arguments to substitute into
11431  /// the constraint expression.
11432  /// \param TemplateIDRange The source range of the template id that
11433  /// caused the constraints check.
11434  /// \param Satisfaction if true is returned, will contain details of the
11435  /// satisfaction, with enough information to diagnose an unsatisfied
11436  /// expression.
11437  /// \returns true if an error occurred and satisfaction could not be checked,
11438  /// false otherwise.
11440  const NamedDecl *Template, ArrayRef<const Expr *> ConstraintExprs,
11441  const MultiLevelTemplateArgumentList &TemplateArgLists,
11442  SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction) {
11443  llvm::SmallVector<Expr *, 4> Converted;
11444  return CheckConstraintSatisfaction(Template, ConstraintExprs, Converted,
11445  TemplateArgLists, TemplateIDRange,
11446  Satisfaction);
11447  }
11448 
11449  /// \brief Check whether the given list of constraint expressions are
11450  /// satisfied (as if in a 'conjunction') given template arguments.
11451  /// Additionally, takes an empty list of Expressions which is populated with
11452  /// the instantiated versions of the ConstraintExprs.
11453  /// \param Template the template-like entity that triggered the constraints
11454  /// check (either a concept or a constrained entity).
11455  /// \param ConstraintExprs a list of constraint expressions, treated as if
11456  /// they were 'AND'ed together.
11457  /// \param ConvertedConstraints a out parameter that will get populated with
11458  /// the instantiated version of the ConstraintExprs if we successfully checked
11459  /// satisfaction.
11460  /// \param TemplateArgList the multi-level list of template arguments to
11461  /// substitute into the constraint expression. This should be relative to the
11462  /// top-level (hence multi-level), since we need to instantiate fully at the
11463  /// time of checking.
11464  /// \param TemplateIDRange The source range of the template id that
11465  /// caused the constraints check.
11466  /// \param Satisfaction if true is returned, will contain details of the
11467  /// satisfaction, with enough information to diagnose an unsatisfied
11468  /// expression.
11469  /// \returns true if an error occurred and satisfaction could not be checked,
11470  /// false otherwise.
11472  const NamedDecl *Template, ArrayRef<const Expr *> ConstraintExprs,
11473  llvm::SmallVectorImpl<Expr *> &ConvertedConstraints,
11474  const MultiLevelTemplateArgumentList &TemplateArgList,
11475  SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction);
11476 
11477  /// \brief Check whether the given non-dependent constraint expression is
11478  /// satisfied. Returns false and updates Satisfaction with the satisfaction
11479  /// verdict if successful, emits a diagnostic and returns true if an error
11480  /// occurred and satisfaction could not be determined.
11481  ///
11482  /// \returns true if an error occurred, false otherwise.
11483  bool CheckConstraintSatisfaction(const Expr *ConstraintExpr,
11484  ConstraintSatisfaction &Satisfaction);
11485 
11486  /// Check whether the given function decl's trailing requires clause is
11487  /// satisfied, if any. Returns false and updates Satisfaction with the
11488  /// satisfaction verdict if successful, emits a diagnostic and returns true if
11489  /// an error occurred and satisfaction could not be determined.
11490  ///
11491  /// \returns true if an error occurred, false otherwise.
11492  bool CheckFunctionConstraints(const FunctionDecl *FD,
11493  ConstraintSatisfaction &Satisfaction,
11494  SourceLocation UsageLoc = SourceLocation(),
11495  bool ForOverloadResolution = false);
11496 
11497  // Calculates whether two constraint expressions are equal irrespective of a
11498  // difference in 'depth'. This takes a pair of optional 'NamedDecl's 'Old' and
11499  // 'New', which are the "source" of the constraint, since this is necessary
11500  // for figuring out the relative 'depth' of the constraint. The depth of the
11501  // 'primary template' and the 'instantiated from' templates aren't necessarily
11502  // the same, such as a case when one is a 'friend' defined in a class.
11503  bool AreConstraintExpressionsEqual(const NamedDecl *Old,
11504  const Expr *OldConstr,
11505  const TemplateCompareNewDeclInfo &New,
11506  const Expr *NewConstr);
11507 
11508  // Calculates whether the friend function depends on an enclosing template for
11509  // the purposes of [temp.friend] p9.
11511 
11512  /// \brief Ensure that the given template arguments satisfy the constraints
11513  /// associated with the given template, emitting a diagnostic if they do not.
11514  ///
11515  /// \param Template The template to which the template arguments are being
11516  /// provided.
11517  ///
11518  /// \param TemplateArgs The converted, canonicalized template arguments.
11519  ///
11520  /// \param TemplateIDRange The source range of the template id that
11521  /// caused the constraints check.
11522  ///
11523  /// \returns true if the constrains are not satisfied or could not be checked
11524  /// for satisfaction, false if the constraints are satisfied.
11526  TemplateDecl *Template,
11527  const MultiLevelTemplateArgumentList &TemplateArgs,
11528  SourceRange TemplateIDRange);
11529 
11531  SourceLocation PointOfInstantiation, FunctionDecl *Decl,
11532  ArrayRef<TemplateArgument> TemplateArgs,
11533  ConstraintSatisfaction &Satisfaction);
11534 
11535  /// \brief Emit diagnostics explaining why a constraint expression was deemed
11536  /// unsatisfied.
11537  /// \param First whether this is the first time an unsatisfied constraint is
11538  /// diagnosed for this error.
11539  void DiagnoseUnsatisfiedConstraint(const ConstraintSatisfaction &Satisfaction,
11540  bool First = true);
11541 
11542  /// \brief Emit diagnostics explaining why a constraint expression was deemed
11543  /// unsatisfied.
11544  void
11546  bool First = true);
11547 
11549  NamedDecl *ConstrainedDecl, ArrayRef<const Expr *> AssociatedConstraints);
11550 
11551  /// \brief Check whether the given declaration's associated constraints are
11552  /// at least as constrained than another declaration's according to the
11553  /// partial ordering of constraints.
11554  ///
11555  /// \param Result If no error occurred, receives the result of true if D1 is
11556  /// at least constrained than D2, and false otherwise.
11557  ///
11558  /// \returns true if an error occurred, false otherwise.
11561  bool &Result);
11562 
11563  /// If D1 was not at least as constrained as D2, but would've been if a pair
11564  /// of atomic constraints involved had been declared in a concept and not
11565  /// repeated in two separate places in code.
11566  /// \returns true if such a diagnostic was emitted, false otherwise.
11570 
11571 private:
11572  /// Caches pairs of template-like decls whose associated constraints were
11573  /// checked for subsumption and whether or not the first's constraints did in
11574  /// fact subsume the second's.
11575  llvm::DenseMap<std::pair<NamedDecl *, NamedDecl *>, bool> SubsumptionCache;
11576  /// Caches the normalized associated constraints of declarations (concepts or
11577  /// constrained declarations). If an error occurred while normalizing the
11578  /// associated constraints of the template or concept, nullptr will be cached
11579  /// here.
11580  llvm::DenseMap<NamedDecl *, NormalizedConstraint *> NormalizationCache;
11581 
11582  llvm::ContextualFoldingSet<ConstraintSatisfaction, const ASTContext &>
11583  SatisfactionCache;
11584 
11585  // The current stack of constraint satisfactions, so we can exit-early.
11587 
11588  /// Introduce the instantiated captures of the lambda into the local
11589  /// instantiation scope.
11590  bool addInstantiatedCapturesToScope(
11591  FunctionDecl *Function, const FunctionDecl *PatternDecl,
11593  const MultiLevelTemplateArgumentList &TemplateArgs);
11594 
11595  /// Used by SetupConstraintCheckingTemplateArgumentsAndScope to recursively(in
11596  /// the case of lambdas) set up the LocalInstantiationScope of the current
11597  /// function.
11598  bool
11599  SetupConstraintScope(FunctionDecl *FD,
11600  std::optional<ArrayRef<TemplateArgument>> TemplateArgs,
11601  const MultiLevelTemplateArgumentList &MLTAL,
11603 
11604  /// Used during constraint checking, sets up the constraint template argument
11605  /// lists, and calls SetupConstraintScope to set up the
11606  /// LocalInstantiationScope to have the proper set of ParVarDecls configured.
11607  std::optional<MultiLevelTemplateArgumentList>
11608  SetupConstraintCheckingTemplateArgumentsAndScope(
11609  FunctionDecl *FD, std::optional<ArrayRef<TemplateArgument>> TemplateArgs,
11611 
11612  ///@}
11613 
11614  //
11615  //
11616  // -------------------------------------------------------------------------
11617  //
11618  //
11619 
11620  /// \name Types
11621  /// Implementations are in SemaType.cpp
11622  ///@{
11623 
11624 public:
11625  /// A mapping that describes the nullability we've seen in each header file.
11627 
11628  static int getPrintable(int I) { return I; }
11629  static unsigned getPrintable(unsigned I) { return I; }
11630  static bool getPrintable(bool B) { return B; }
11631  static const char *getPrintable(const char *S) { return S; }
11632  static StringRef getPrintable(StringRef S) { return S; }
11633  static const std::string &getPrintable(const std::string &S) { return S; }
11634  static const IdentifierInfo *getPrintable(const IdentifierInfo *II) {
11635  return II;
11636  }
11638  static QualType getPrintable(QualType T) { return T; }
11639  static SourceRange getPrintable(SourceRange R) { return R; }
11640  static SourceRange getPrintable(SourceLocation L) { return L; }
11641  static SourceRange getPrintable(const Expr *E) { return E->getSourceRange(); }
11642  static SourceRange getPrintable(TypeLoc TL) { return TL.getSourceRange(); }
11643 
11644  enum class CompleteTypeKind {
11645  /// Apply the normal rules for complete types. In particular,
11646  /// treat all sizeless types as incomplete.
11647  Normal,
11648 
11649  /// Relax the normal rules for complete types so that they include
11650  /// sizeless built-in types.
11651  AcceptSizeless,
11652 
11653  // FIXME: Eventually we should flip the default to Normal and opt in
11654  // to AcceptSizeless rather than opt out of it.
11655  Default = AcceptSizeless
11656  };
11657 
11658  /// Build a an Objective-C protocol-qualified 'id' type where no
11659  /// base type was specified.
11661  SourceLocation lAngleLoc, ArrayRef<Decl *> protocols,
11662  ArrayRef<SourceLocation> protocolLocs, SourceLocation rAngleLoc);
11663 
11664  /// Build a specialized and/or protocol-qualified Objective-C type.
11666  Scope *S, SourceLocation Loc, ParsedType BaseType,
11667  SourceLocation TypeArgsLAngleLoc, ArrayRef<ParsedType> TypeArgs,
11668  SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc,
11669  ArrayRef<Decl *> Protocols, ArrayRef<SourceLocation> ProtocolLocs,
11670  SourceLocation ProtocolRAngleLoc);
11671 
11672  /// Build an Objective-C type parameter type.
11674  SourceLocation ProtocolLAngleLoc,
11675  ArrayRef<ObjCProtocolDecl *> Protocols,
11676  ArrayRef<SourceLocation> ProtocolLocs,
11677  SourceLocation ProtocolRAngleLoc,
11678  bool FailOnError = false);
11679 
11680  /// Build an Objective-C object pointer type.
11682  QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc,
11683  ArrayRef<TypeSourceInfo *> TypeArgs, SourceLocation TypeArgsRAngleLoc,
11684  SourceLocation ProtocolLAngleLoc, ArrayRef<ObjCProtocolDecl *> Protocols,
11685  ArrayRef<SourceLocation> ProtocolLocs, SourceLocation ProtocolRAngleLoc,
11686  bool FailOnError, bool Rebuilding);
11687 
11689  const DeclSpec *DS = nullptr);
11690  QualType BuildQualifiedType(QualType T, SourceLocation Loc, unsigned CVRA,
11691  const DeclSpec *DS = nullptr);
11693  DeclarationName Entity);
11694  QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc,
11695  DeclarationName Entity);
11697  unsigned Quals, SourceRange Brackets,
11698  DeclarationName Entity);
11699  QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc);
11701  SourceLocation AttrLoc);
11702  QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns,
11703  SourceLocation AttrLoc);
11704 
11705  QualType BuildCountAttributedArrayType(QualType WrappedTy, Expr *CountExpr);
11706 
11707  QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace,
11708  SourceLocation AttrLoc);
11709 
11710  /// Same as above, but constructs the AddressSpace index if not provided.
11712  SourceLocation AttrLoc);
11713 
11715 
11717 
11718  /// Build a function type.
11719  ///
11720  /// This routine checks the function type according to C++ rules and
11721  /// under the assumption that the result type and parameter types have
11722  /// just been instantiated from a template. It therefore duplicates
11723  /// some of the behavior of GetTypeForDeclarator, but in a much
11724  /// simpler form that is only suitable for this narrow use case.
11725  ///
11726  /// \param T The return type of the function.
11727  ///
11728  /// \param ParamTypes The parameter types of the function. This array
11729  /// will be modified to account for adjustments to the types of the
11730  /// function parameters.
11731  ///
11732  /// \param Loc The location of the entity whose type involves this
11733  /// function type or, if there is no such entity, the location of the
11734  /// type that will have function type.
11735  ///
11736  /// \param Entity The name of the entity that involves the function
11737  /// type, if known.
11738  ///
11739  /// \param EPI Extra information about the function type. Usually this will
11740  /// be taken from an existing function with the same prototype.
11741  ///
11742  /// \returns A suitable function type, if there are no errors. The
11743  /// unqualified type will always be a FunctionProtoType.
11744  /// Otherwise, returns a NULL type.
11746  SourceLocation Loc, DeclarationName Entity,
11747  const FunctionProtoType::ExtProtoInfo &EPI);
11748 
11750  SourceLocation Loc, DeclarationName Entity);
11752  DeclarationName Entity);
11757  QualType BuildBitIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc);
11758 
11761 
11762  /// Package the given type and TSI into a ParsedType.
11765  TypeSourceInfo **TInfo = nullptr);
11766 
11768 
11769  /// The parser has parsed the context-sensitive type 'instancetype'
11770  /// in an Objective-C message declaration. Return the appropriate type.
11772 
11773  // Check whether the size of array element of type \p EltTy is a multiple of
11774  // its alignment and return false if it isn't.
11776 
11777  void
11778  diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals,
11779  SourceLocation FallbackLoc,
11780  SourceLocation ConstQualLoc = SourceLocation(),
11781  SourceLocation VolatileQualLoc = SourceLocation(),
11782  SourceLocation RestrictQualLoc = SourceLocation(),
11783  SourceLocation AtomicQualLoc = SourceLocation(),
11784  SourceLocation UnalignedQualLoc = SourceLocation());
11785 
11786  /// Retrieve the keyword associated
11788 
11789  /// The struct behind the CFErrorRef pointer.
11790  RecordDecl *CFError = nullptr;
11791  bool isCFError(RecordDecl *D);
11792 
11793  /// Retrieve the identifier "NSError".
11795 
11796  /// Adjust the calling convention of a method to be the ABI default if it
11797  /// wasn't specified explicitly. This handles method types formed from
11798  /// function type typedefs and typename template arguments.
11799  void adjustMemberFunctionCC(QualType &T, bool HasThisPointer,
11800  bool IsCtorOrDtor, SourceLocation Loc);
11801 
11802  // Check if there is an explicit attribute, but only look through parens.
11803  // The intent is to look for an attribute on the current declarator, but not
11804  // one that came from a typedef.
11806 
11807  /// Check whether a nullability type specifier can be added to the given
11808  /// type through some means not written in source (e.g. API notes).
11809  ///
11810  /// \param Type The type to which the nullability specifier will be
11811  /// added. On success, this type will be updated appropriately.
11812  ///
11813  /// \param Nullability The nullability specifier to add.
11814  ///
11815  /// \param DiagLoc The location to use for diagnostics.
11816  ///
11817  /// \param AllowArrayTypes Whether to accept nullability specifiers on an
11818  /// array type (e.g., because it will decay to a pointer).
11819  ///
11820  /// \param OverrideExisting Whether to override an existing, locally-specified
11821  /// nullability specifier rather than complaining about the conflict.
11822  ///
11823  /// \returns true if nullability cannot be applied, false otherwise.
11826  SourceLocation DiagLoc,
11827  bool AllowArrayTypes,
11828  bool OverrideExisting);
11829 
11830  /// Get the type of expression E, triggering instantiation to complete the
11831  /// type if necessary -- that is, if the expression refers to a templated
11832  /// static data member of incomplete array type.
11833  ///
11834  /// May still return an incomplete type if instantiation was not possible or
11835  /// if the type is incomplete for a different reason. Use
11836  /// RequireCompleteExprType instead if a diagnostic is expected for an
11837  /// incomplete expression type.
11839 
11840  void completeExprArrayBound(Expr *E);
11842  TypeDiagnoser &Diagnoser);
11843  bool RequireCompleteExprType(Expr *E, unsigned DiagID);
11844 
11845  template <typename... Ts>
11846  bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args) {
11847  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
11848  return RequireCompleteExprType(E, CompleteTypeKind::Default, Diagnoser);
11849  }
11850 
11852  const CXXScopeSpec &SS, QualType T,
11853  TagDecl *OwnedTagDecl = nullptr);
11854 
11855  // Returns the underlying type of a decltype with the given expression.
11857 
11859  /// If AsUnevaluated is false, E is treated as though it were an evaluated
11860  /// context, such as when building a type for decltype(auto).
11861  QualType BuildDecltypeType(Expr *E, bool AsUnevaluated = true);
11862 
11863  QualType ActOnPackIndexingType(QualType Pattern, Expr *IndexExpr,
11864  SourceLocation Loc,
11865  SourceLocation EllipsisLoc);
11866  QualType BuildPackIndexingType(QualType Pattern, Expr *IndexExpr,
11867  SourceLocation Loc, SourceLocation EllipsisLoc,
11868  bool FullySubstituted = false,
11869  ArrayRef<QualType> Expansions = {});
11870 
11873  SourceLocation Loc);
11878  QualType BuiltinAddReference(QualType BaseType, UTTKind UKind,
11879  SourceLocation Loc);
11880  QualType BuiltinRemoveExtent(QualType BaseType, UTTKind UKind,
11881  SourceLocation Loc);
11883  SourceLocation Loc);
11885  SourceLocation Loc);
11887  SourceLocation Loc);
11888 
11890  TypeDiagnoser &Diagnoser);
11891  bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID);
11892 
11893  template <typename... Ts>
11894  bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID,
11895  const Ts &...Args) {
11896  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
11897  return RequireLiteralType(Loc, T, Diagnoser);
11898  }
11899 
11902  return !RequireCompleteTypeImpl(Loc, T, Kind, nullptr);
11903  }
11905  CompleteTypeKind Kind, TypeDiagnoser &Diagnoser);
11907  CompleteTypeKind Kind, unsigned DiagID);
11908 
11910  TypeDiagnoser &Diagnoser) {
11911  return RequireCompleteType(Loc, T, CompleteTypeKind::Default, Diagnoser);
11912  }
11913  bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID) {
11914  return RequireCompleteType(Loc, T, CompleteTypeKind::Default, DiagID);
11915  }
11916 
11917  template <typename... Ts>
11918  bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID,
11919  const Ts &...Args) {
11920  BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
11921  return RequireCompleteType(Loc, T, Diagnoser);
11922  }
11923 
11924  /// Determine whether a declaration is visible to name lookup.
11925  bool isVisible(const NamedDecl *D) {
11926  return D->isUnconditionallyVisible() ||
11927  isAcceptableSlow(D, AcceptableKind::Visible);
11928  }
11929 
11930  /// Determine whether a declaration is reachable.
11931  bool isReachable(const NamedDecl *D) {
11932  // All visible declarations are reachable.
11933  return D->isUnconditionallyVisible() ||
11934  isAcceptableSlow(D, AcceptableKind::Reachable);
11935  }
11936 
11937  /// Determine whether a declaration is acceptable (visible/reachable).
11939  return Kind == AcceptableKind::Visible ? isVisible(D) : isReachable(D);
11940  }
11941 
11942  /// Determine if \p D and \p Suggested have a structurally compatible
11943  /// layout as described in C11 6.2.7/1.
11944  bool hasStructuralCompatLayout(Decl *D, Decl *Suggested);
11945 
11946  /// Determine if \p D has a visible definition. If not, suggest a declaration
11947  /// that should be made visible to expose the definition.
11948  bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested,
11949  bool OnlyNeedComplete = false);
11951  NamedDecl *Hidden;
11952  return hasVisibleDefinition(const_cast<NamedDecl *>(D), &Hidden);
11953  }
11954 
11955  /// Determine if \p D has a reachable definition. If not, suggest a
11956  /// declaration that should be made reachable to expose the definition.
11957  bool hasReachableDefinition(NamedDecl *D, NamedDecl **Suggested,
11958  bool OnlyNeedComplete = false);
11960  NamedDecl *Hidden;
11961  return hasReachableDefinition(D, &Hidden);
11962  }
11963 
11964  bool hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested,
11966  bool OnlyNeedComplete = false);
11968  NamedDecl *Hidden;
11969  return hasAcceptableDefinition(D, &Hidden, Kind);
11970  }
11971 
11972 private:
11973  bool RequireCompleteTypeImpl(SourceLocation Loc, QualType T,
11974  CompleteTypeKind Kind, TypeDiagnoser *Diagnoser);
11975 
11976  /// Nullability type specifiers.
11977  IdentifierInfo *Ident__Nonnull = nullptr;
11978  IdentifierInfo *Ident__Nullable = nullptr;
11979  IdentifierInfo *Ident__Nullable_result = nullptr;
11980  IdentifierInfo *Ident__Null_unspecified = nullptr;
11981 
11982  IdentifierInfo *Ident_NSError = nullptr;
11983 
11984  ///@}
11985 
11986  //
11987  //
11988  // -------------------------------------------------------------------------
11989  //
11990  //
11991 
11992  /// \name ObjC Declarations
11993  /// Implementations are in SemaDeclObjC.cpp
11994  ///@{
11995 
11996 public:
12004  };
12005 
12006  /// Method selectors used in a \@selector expression. Used for implementation
12007  /// of -Wselector.
12008  llvm::MapVector<Selector, SourceLocation> ReferencedSelectors;
12009 
12011  public:
12012  using Lists = std::pair<ObjCMethodList, ObjCMethodList>;
12013  using iterator = llvm::DenseMap<Selector, Lists>::iterator;
12014  iterator begin() { return Methods.begin(); }
12015  iterator end() { return Methods.end(); }
12016  iterator find(Selector Sel) { return Methods.find(Sel); }
12017  std::pair<iterator, bool> insert(std::pair<Selector, Lists> &&Val) {
12018  return Methods.insert(Val);
12019  }
12020  int count(Selector Sel) const { return Methods.count(Sel); }
12021  bool empty() const { return Methods.empty(); }
12022 
12023  private:
12024  llvm::DenseMap<Selector, Lists> Methods;
12025  };
12026 
12027  /// Method Pool - allows efficient lookup when typechecking messages to "id".
12028  /// We need to maintain a list, since selectors can have differing signatures
12029  /// across classes. In Cocoa, this happens to be extremely uncommon (only 1%
12030  /// of selectors are "overloaded").
12031  /// At the head of the list it is recorded whether there were 0, 1, or >= 2
12032  /// methods inside categories with a particular selector.
12034 
12035  /// Check ODR hashes for C/ObjC when merging types from modules.
12036  /// Differently from C++, actually parse the body and reject in case
12037  /// of a mismatch.
12038  template <typename T,
12039  typename = std::enable_if_t<std::is_base_of<NamedDecl, T>::value>>
12041  if (Duplicate->getODRHash() != Previous->getODRHash())
12042  return false;
12043 
12044  // Make the previous decl visible.
12046  return true;
12047  }
12048 
12050 
12052 
12054  OCK_None = -1,
12061  };
12063 
12065  SourceLocation varianceLoc, unsigned index,
12066  IdentifierInfo *paramName,
12067  SourceLocation paramLoc,
12068  SourceLocation colonLoc, ParsedType typeBound);
12069 
12071  ArrayRef<Decl *> typeParams,
12072  SourceLocation rAngleLoc);
12073  void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList);
12074 
12076  Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName,
12077  SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
12078  IdentifierInfo *SuperName, SourceLocation SuperLoc,
12079  ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange,
12080  Decl *const *ProtoRefs, unsigned NumProtoRefs,
12081  const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
12082  const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody);
12083 
12085  Scope *S, SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *IDecl,
12086  IdentifierInfo *ClassName, SourceLocation ClassLoc,
12087  IdentifierInfo *SuperName, SourceLocation SuperLoc,
12088  ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange);
12089 
12091  SmallVectorImpl<SourceLocation> &ProtocolLocs,
12092  IdentifierInfo *SuperName,
12093  SourceLocation SuperLoc);
12094 
12095  Decl *ActOnCompatibilityAlias(SourceLocation AtCompatibilityAliasLoc,
12096  IdentifierInfo *AliasName,
12097  SourceLocation AliasLocation,
12098  IdentifierInfo *ClassName,
12099  SourceLocation ClassLocation);
12100 
12102  IdentifierInfo *PName, SourceLocation &PLoc, SourceLocation PrevLoc,
12103  const ObjCList<ObjCProtocolDecl> &PList);
12104 
12106  SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName,
12107  SourceLocation ProtocolLoc, Decl *const *ProtoRefNames,
12108  unsigned NumProtoRefs, const SourceLocation *ProtoLocs,
12109  SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList,
12110  SkipBodyInfo *SkipBody);
12111 
12113  SourceLocation AtInterfaceLoc, const IdentifierInfo *ClassName,
12114  SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
12115  const IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
12116  Decl *const *ProtoRefs, unsigned NumProtoRefs,
12117  const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
12118  const ParsedAttributesView &AttrList);
12119 
12121  SourceLocation AtClassImplLoc, const IdentifierInfo *ClassName,
12122  SourceLocation ClassLoc, const IdentifierInfo *SuperClassname,
12123  SourceLocation SuperClassLoc, const ParsedAttributesView &AttrList);
12124 
12126  SourceLocation AtCatImplLoc, const IdentifierInfo *ClassName,
12127  SourceLocation ClassLoc, const IdentifierInfo *CatName,
12128  SourceLocation CatLoc, const ParsedAttributesView &AttrList);
12129 
12131  ArrayRef<Decl *> Decls);
12132 
12135  ArrayRef<IdentifierLocPair> IdentList,
12136  const ParsedAttributesView &attrList);
12137 
12138  void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer,
12139  ArrayRef<IdentifierLocPair> ProtocolId,
12140  SmallVectorImpl<Decl *> &Protocols);
12141 
12143  SourceLocation ProtocolLoc,
12144  IdentifierInfo *TypeArgId,
12145  SourceLocation TypeArgLoc,
12146  bool SelectProtocolFirst = false);
12147 
12148  /// Given a list of identifiers (and their locations), resolve the
12149  /// names to either Objective-C protocol qualifiers or type
12150  /// arguments, as appropriate.
12152  Scope *S, ParsedType baseType, SourceLocation lAngleLoc,
12153  ArrayRef<IdentifierInfo *> identifiers,
12154  ArrayRef<SourceLocation> identifierLocs, SourceLocation rAngleLoc,
12155  SourceLocation &typeArgsLAngleLoc, SmallVectorImpl<ParsedType> &typeArgs,
12156  SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc,
12157  SmallVectorImpl<Decl *> &protocols, SourceLocation &protocolRAngleLoc,
12158  bool warnOnIncompleteProtocols);
12159 
12162 
12163  Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd,
12164  ArrayRef<Decl *> allMethods = std::nullopt,
12165  ArrayRef<DeclGroupPtrTy> allTUVars = std::nullopt);
12166 
12167  struct ObjCArgInfo {
12170  // The Type is null if no type was specified, and the DeclSpec is invalid
12171  // in this case.
12174 
12175  /// ArgAttrs - Attribute list for this argument.
12177  };
12178 
12180  Scope *S,
12181  SourceLocation BeginLoc, // location of the + or -.
12182  SourceLocation EndLoc, // location of the ; or {.
12183  tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType,
12184  ArrayRef<SourceLocation> SelectorLocs, Selector Sel,
12185  // optional arguments. The number of types/arguments is obtained
12186  // from the Sel.getNumArgs().
12187  ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo,
12188  unsigned CNumArgs, // c-style args
12189  const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind,
12190  bool isVariadic, bool MethodDefinition);
12191 
12192  bool CheckARCMethodDecl(ObjCMethodDecl *method);
12193 
12194  bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall);
12195 
12196  /// Check whether the given new method is a valid override of the
12197  /// given overridden method, and set any properties that should be inherited.
12198  void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod,
12199  const ObjCMethodDecl *Overridden);
12200 
12201  /// Describes the compatibility of a result type with its method.
12205  RTC_Unknown
12206  };
12207 
12209  ObjCMethodDecl *overridden);
12210 
12211  void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod,
12212  ObjCInterfaceDecl *CurrentClass,
12214 
12215  /// AddAnyMethodToGlobalPool - Add any method, instance or factory to global
12216  /// pool.
12217  void AddAnyMethodToGlobalPool(Decl *D);
12218 
12219  void ActOnStartOfObjCMethodDef(Scope *S, Decl *D);
12220  bool isObjCMethodDecl(Decl *D) { return D && isa<ObjCMethodDecl>(D); }
12221 
12222  /// CheckImplementationIvars - This routine checks if the instance variables
12223  /// listed in the implelementation match those listed in the interface.
12225  ObjCIvarDecl **Fields, unsigned nIvars,
12226  SourceLocation Loc);
12227 
12229  ObjCMethodDecl *MethodDecl,
12230  bool IsProtocolMethodDecl);
12231 
12233  ObjCMethodDecl *Overridden,
12234  bool IsProtocolMethodDecl);
12235 
12236  /// WarnExactTypedMethods - This routine issues a warning if method
12237  /// implementation declaration matches exactly that of its declaration.
12238  void WarnExactTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl,
12239  bool IsProtocolMethodDecl);
12240 
12241  /// MatchAllMethodDeclarations - Check methods declaraed in interface or
12242  /// or protocol against those declared in their implementations.
12244  const SelectorSet &InsMap, const SelectorSet &ClsMap,
12245  SelectorSet &InsMapSeen, SelectorSet &ClsMapSeen, ObjCImplDecl *IMPDecl,
12246  ObjCContainerDecl *IDecl, bool &IncompleteImpl, bool ImmediateClass,
12247  bool WarnCategoryMethodImpl = false);
12248 
12249  /// CheckCategoryVsClassMethodMatches - Checks that methods implemented in
12250  /// category matches with those implemented in its primary class and
12251  /// warns each time an exact match is found.
12253 
12254  /// ImplMethodsVsClassMethods - This is main routine to warn if any method
12255  /// remains unimplemented in the class or category \@implementation.
12256  void ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl *IMPDecl,
12257  ObjCContainerDecl *IDecl,
12258  bool IncompleteImpl = false);
12259 
12261  SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs,
12262  ArrayRef<ObjCTypeParamList *> TypeParamLists, unsigned NumElts);
12263 
12264  /// MatchTwoMethodDeclarations - Checks if two methods' type match and returns
12265  /// true, or false, accordingly.
12266  bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method,
12267  const ObjCMethodDecl *PrevMethod,
12268  MethodMatchStrategy strategy = MMS_strict);
12269 
12270  /// Add the given method to the list of globally-known methods.
12272 
12273  void ReadMethodPool(Selector Sel);
12275 
12276  /// - Returns instance or factory methods in global method pool for
12277  /// given selector. It checks the desired kind first, if none is found, and
12278  /// parameter checkTheOther is set, it then checks the other kind. If no such
12279  /// method or only one method is found, function returns false; otherwise, it
12280  /// returns true.
12281  bool
12284  bool InstanceFirst, bool CheckTheOther,
12285  const ObjCObjectType *TypeBound = nullptr);
12286 
12287  bool
12289  SourceRange R, bool receiverIdOrClass,
12291 
12292  void
12294  Selector Sel, SourceRange R,
12295  bool receiverIdOrClass);
12296 
12297  const ObjCMethodDecl *
12299  /// LookupImplementedMethodInGlobalPool - Returns the method which has an
12300  /// implementation.
12302 
12304 
12305  /// Checks that the Objective-C declaration is declared in the global scope.
12306  /// Emits an error and marks the declaration as invalid if it's not declared
12307  /// in the global scope.
12308  bool CheckObjCDeclScope(Decl *D);
12309 
12310  void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
12311  const IdentifierInfo *ClassName,
12312  SmallVectorImpl<Decl *> &Decls);
12313 
12314  VarDecl *BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType,
12315  SourceLocation StartLoc, SourceLocation IdLoc,
12316  const IdentifierInfo *Id,
12317  bool Invalid = false);
12318 
12320 
12321  /// CollectIvarsToConstructOrDestruct - Collect those ivars which require
12322  /// initialization.
12323  void
12326 
12328 
12329  /// DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar
12330  /// which backs the property is not used in the property's accessor.
12332  const ObjCImplementationDecl *ImplD);
12333 
12334  /// GetIvarBackingPropertyAccessor - If method is a property setter/getter and
12335  /// it property has a backing ivar, returns this ivar; otherwise, returns
12336  /// NULL. It also returns ivar's property on success.
12337  ObjCIvarDecl *
12339  const ObjCPropertyDecl *&PDecl) const;
12340 
12341  /// AddInstanceMethodToGlobalPool - All instance methods in a translation
12342  /// unit are added to a global pool. This allows us to efficiently associate
12343  /// a selector with a method declaraation for purposes of typechecking
12344  /// messages sent to "id" (where the class of the object is unknown).
12346  bool impl = false) {
12347  AddMethodToGlobalPool(Method, impl, /*instance*/ true);
12348  }
12349 
12350  /// AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
12351  void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl = false) {
12352  AddMethodToGlobalPool(Method, impl, /*instance*/ false);
12353  }
12354 
12355 private:
12356  /// AddMethodToGlobalPool - Add an instance or factory method to the global
12357  /// pool. See descriptoin of AddInstanceMethodToGlobalPool.
12358  void AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl, bool instance);
12359 
12360  /// LookupMethodInGlobalPool - Returns the instance or factory method and
12361  /// optionally warns if there are multiple signatures.
12362  ObjCMethodDecl *LookupMethodInGlobalPool(Selector Sel, SourceRange R,
12363  bool receiverIdOrClass,
12364  bool instance);
12365 
12366  ///@}
12367 
12368  //
12369  //
12370  // -------------------------------------------------------------------------
12371  //
12372  //
12373 
12374  /// \name ObjC Expressions
12375  /// Implementations are in SemaExprObjC.cpp
12376  ///@{
12377 
12378 public:
12379  /// Caches identifiers/selectors for NSFoundation APIs.
12380  std::unique_ptr<NSAPI> NSAPIObj;
12381 
12382  /// The declaration of the Objective-C NSNumber class.
12384 
12385  /// The declaration of the Objective-C NSValue class.
12387 
12388  /// Pointer to NSNumber type (NSNumber *).
12390 
12391  /// Pointer to NSValue type (NSValue *).
12393 
12394  /// The Objective-C NSNumber methods used to create NSNumber literals.
12396 
12397  /// The declaration of the Objective-C NSString class.
12399 
12400  /// Pointer to NSString type (NSString *).
12402 
12403  /// The declaration of the stringWithUTF8String: method.
12405 
12406  /// The declaration of the valueWithBytes:objCType: method.
12408 
12409  /// The declaration of the Objective-C NSArray class.
12411 
12412  /// The declaration of the arrayWithObjects:count: method.
12414 
12415  /// The declaration of the Objective-C NSDictionary class.
12417 
12418  /// The declaration of the dictionaryWithObjects:forKeys:count: method.
12420 
12421  /// id<NSCopying> type.
12423 
12424  /// will hold 'respondsToSelector:'
12426 
12428  Expr *BaseExpr, SourceLocation OpLoc,
12429  DeclarationName MemberName,
12430  SourceLocation MemberLoc,
12431  SourceLocation SuperLoc,
12432  QualType SuperType, bool Super);
12433 
12435  const IdentifierInfo &propertyName,
12436  SourceLocation receiverNameLoc,
12437  SourceLocation propertyNameLoc);
12438 
12439  // ParseObjCStringLiteral - Parse Objective-C string literals.
12441  ArrayRef<Expr *> Strings);
12442 
12444 
12445  /// BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the
12446  /// numeric literal expression. Type of the expression will be "NSNumber *"
12447  /// or "id" if NSNumber is unavailable.
12450  bool Value);
12452 
12453  /// BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the
12454  /// '@' prefixed parenthesized expression. The type of the expression will
12455  /// either be "NSNumber *", "NSString *" or "NSValue *" depending on the type
12456  /// of ValueType, which is allowed to be a built-in numeric type, "char *",
12457  /// "const char *" or C structure with attribute 'objc_boxable'.
12459 
12461  Expr *IndexExpr,
12462  ObjCMethodDecl *getterMethod,
12463  ObjCMethodDecl *setterMethod);
12464 
12465  ExprResult
12468 
12470  TypeSourceInfo *EncodedTypeInfo,
12471  SourceLocation RParenLoc);
12472 
12474  SourceLocation EncodeLoc,
12475  SourceLocation LParenLoc, ParsedType Ty,
12476  SourceLocation RParenLoc);
12477 
12478  /// ParseObjCSelectorExpression - Build selector expression for \@selector
12480  SourceLocation SelLoc,
12481  SourceLocation LParenLoc,
12482  SourceLocation RParenLoc,
12483  bool WarnMultipleSelectors);
12484 
12485  /// ParseObjCProtocolExpression - Build protocol expression for \@protocol
12487  SourceLocation AtLoc,
12488  SourceLocation ProtoLoc,
12489  SourceLocation LParenLoc,
12490  SourceLocation ProtoIdLoc,
12491  SourceLocation RParenLoc);
12492 
12494 
12495  /// Describes the kind of message expression indicated by a message
12496  /// send that starts with an identifier.
12498  /// The message is sent to 'super'.
12500  /// The message is an instance message.
12502  /// The message is a class message, and the identifier is a type
12503  /// name.
12505  };
12506 
12508  SourceLocation NameLoc, bool IsSuper,
12509  bool HasTrailingDot,
12510  ParsedType &ReceiverType);
12511 
12513  SourceLocation LBracLoc,
12514  ArrayRef<SourceLocation> SelectorLocs,
12515  SourceLocation RBracLoc, MultiExprArg Args);
12516 
12517  ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
12518  QualType ReceiverType, SourceLocation SuperLoc,
12519  Selector Sel, ObjCMethodDecl *Method,
12520  SourceLocation LBracLoc,
12521  ArrayRef<SourceLocation> SelectorLocs,
12522  SourceLocation RBracLoc, MultiExprArg Args,
12523  bool isImplicit = false);
12524 
12526  bool isSuperReceiver, SourceLocation Loc,
12527  Selector Sel, ObjCMethodDecl *Method,
12528  MultiExprArg Args);
12529 
12531  SourceLocation LBracLoc,
12532  ArrayRef<SourceLocation> SelectorLocs,
12533  SourceLocation RBracLoc, MultiExprArg Args);
12534 
12535  ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType,
12536  SourceLocation SuperLoc, Selector Sel,
12537  ObjCMethodDecl *Method,
12538  SourceLocation LBracLoc,
12539  ArrayRef<SourceLocation> SelectorLocs,
12540  SourceLocation RBracLoc, MultiExprArg Args,
12541  bool isImplicit = false);
12542 
12543  ExprResult BuildInstanceMessageImplicit(Expr *Receiver, QualType ReceiverType,
12544  SourceLocation Loc, Selector Sel,
12545  ObjCMethodDecl *Method,
12546  MultiExprArg Args);
12547 
12548  ExprResult ActOnInstanceMessage(Scope *S, Expr *Receiver, Selector Sel,
12549  SourceLocation LBracLoc,
12550  ArrayRef<SourceLocation> SelectorLocs,
12551  SourceLocation RBracLoc, MultiExprArg Args);
12552 
12555  SourceLocation BridgeKeywordLoc,
12556  TypeSourceInfo *TSInfo, Expr *SubExpr);
12557 
12560  SourceLocation BridgeKeywordLoc,
12561  ParsedType Type, SourceLocation RParenLoc,
12562  Expr *SubExpr);
12563 
12564  void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr);
12565 
12567 
12569  CastKind &Kind);
12570 
12572  QualType SrcType,
12573  ObjCInterfaceDecl *&RelatedClass,
12574  ObjCMethodDecl *&ClassMethod,
12575  ObjCMethodDecl *&InstanceMethod,
12576  TypedefNameDecl *&TDNDecl, bool CfToNs,
12577  bool Diagnose = true);
12578 
12580  QualType SrcType, Expr *&SrcExpr,
12581  bool Diagnose = true);
12582 
12583  /// Private Helper predicate to check for 'self'.
12584  bool isSelfExpr(Expr *RExpr);
12585  bool isSelfExpr(Expr *RExpr, const ObjCMethodDecl *Method);
12586 
12588  const ObjCObjectPointerType *OPT,
12589  bool IsInstance);
12591  bool IsInstance);
12592 
12593  bool isKnownName(StringRef name);
12594 
12596 
12597  /// Checks for invalid conversions and casts between
12598  /// retainable pointers and other pointer kinds for ARC and Weak.
12600  QualType castType, Expr *&op,
12602  bool Diagnose = true,
12603  bool DiagnoseCFAudited = false,
12604  BinaryOperatorKind Opc = BO_PtrMemD);
12605 
12607  void diagnoseARCUnbridgedCast(Expr *e);
12608 
12610  QualType ExprType);
12611 
12612  /// CheckMessageArgumentTypes - Check types in an Obj-C message send.
12613  /// \param Method - May be null.
12614  /// \param [out] ReturnType - The return type of the send.
12615  /// \return true iff there were any incompatible types.
12616  bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType,
12617  MultiExprArg Args, Selector Sel,
12618  ArrayRef<SourceLocation> SelectorLocs,
12619  ObjCMethodDecl *Method, bool isClassMessage,
12620  bool isSuperMessage, SourceLocation lbrac,
12621  SourceLocation rbrac, SourceRange RecRange,
12622  QualType &ReturnType, ExprValueKind &VK);
12623 
12624  /// Determine the result of a message send expression based on
12625  /// the type of the receiver, the method expected to receive the message,
12626  /// and the form of the message send.
12627  QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType,
12628  ObjCMethodDecl *Method, bool isClassMessage,
12629  bool isSuperMessage);
12630 
12631  /// If the given expression involves a message send to a method
12632  /// with a related result type, emit a note describing what happened.
12633  void EmitRelatedResultTypeNote(const Expr *E);
12634 
12635  /// Given that we had incompatible pointer types in a return
12636  /// statement, check whether we're in a method with a related result
12637  /// type, and if so, emit a note describing what happened.
12639 
12640  /// LookupInstanceMethodInGlobalPool - Returns the method and warns if
12641  /// there are multiple signatures.
12642  ObjCMethodDecl *
12644  bool receiverIdOrClass = false) {
12645  return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
12646  /*instance*/ true);
12647  }
12648 
12649  /// LookupFactoryMethodInGlobalPool - Returns the method and warns if
12650  /// there are multiple signatures.
12651  ObjCMethodDecl *
12653  bool receiverIdOrClass = false) {
12654  return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
12655  /*instance*/ false);
12656  }
12657 
12658  ///@}
12659 
12660  //
12661  //
12662  // -------------------------------------------------------------------------
12663  //
12664  //
12665 
12666  /// \name ObjC @property and @synthesize
12667  /// Implementations are in SemaObjCProperty.cpp
12668  ///@{
12669 
12670 public:
12671  /// Ensure attributes are consistent with type.
12672  /// \param [in, out] Attributes The attributes to check; they will
12673  /// be modified to be consistent with \p PropertyTy.
12674  void CheckObjCPropertyAttributes(Decl *PropertyPtrTy, SourceLocation Loc,
12675  unsigned &Attributes,
12676  bool propertyInPrimaryClass);
12677 
12678  /// Process the specified property declaration and create decls for the
12679  /// setters and getters as needed.
12680  /// \param property The property declaration being processed
12681  void ProcessPropertyDecl(ObjCPropertyDecl *property);
12682 
12683  Decl *ActOnProperty(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc,
12684  FieldDeclarator &FD, ObjCDeclSpec &ODS,
12685  Selector GetterSel, Selector SetterSel,
12686  tok::ObjCKeywordKind MethodImplKind,
12687  DeclContext *lexicalDC = nullptr);
12688 
12690  SourceLocation PropertyLoc, bool ImplKind,
12691  IdentifierInfo *PropertyId,
12692  IdentifierInfo *PropertyIvar,
12693  SourceLocation PropertyIvarLoc,
12694  ObjCPropertyQueryKind QueryKind);
12695 
12696  /// Called by ActOnProperty to handle \@property declarations in
12697  /// class extensions.
12699  Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc,
12700  FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc,
12701  Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite,
12702  unsigned &Attributes, const unsigned AttributesAsWritten, QualType T,
12703  TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind);
12704 
12705  /// Called by ActOnProperty and HandlePropertyInClassExtension to
12706  /// handle creating the ObjcPropertyDecl for a category or \@interface.
12709  SourceLocation LParenLoc, FieldDeclarator &FD,
12710  Selector GetterSel, SourceLocation GetterNameLoc,
12711  Selector SetterSel, SourceLocation SetterNameLoc,
12712  const bool isReadWrite, const unsigned Attributes,
12713  const unsigned AttributesAsWritten, QualType T,
12714  TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind,
12715  DeclContext *lexicalDC = nullptr);
12716 
12718  ObjCPropertyDecl *SuperProperty,
12719  const IdentifierInfo *Name,
12720  bool OverridingProtocolProperty);
12721 
12723  ObjCMethodDecl *Getter,
12724  SourceLocation Loc);
12725 
12726  /// DiagnoseUnimplementedProperties - This routine warns on those properties
12727  /// which must be implemented by this implementation.
12729  ObjCContainerDecl *CDecl,
12730  bool SynthesizeProperties);
12731 
12732  /// Diagnose any null-resettable synthesized setters.
12734 
12735  /// DefaultSynthesizeProperties - This routine default synthesizes all
12736  /// properties which must be synthesized in the class's \@implementation.
12738  ObjCInterfaceDecl *IDecl,
12739  SourceLocation AtEnd);
12741 
12742  /// IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is
12743  /// an ivar synthesized for 'Method' and 'Method' is a property accessor
12744  /// declared in class 'IFace'.
12746  ObjCMethodDecl *Method, ObjCIvarDecl *IV);
12747 
12749 
12750  void
12752  const ObjCInterfaceDecl *IFD);
12753 
12754  /// AtomicPropertySetterGetterRules - This routine enforces the rule (via
12755  /// warning) when atomic property has one but not the other user-declared
12756  /// setter or getter.
12758  ObjCInterfaceDecl *IDecl);
12759 
12760  ///@}
12761 
12762  //
12763  //
12764  // -------------------------------------------------------------------------
12765  //
12766  //
12767 
12768  /// \name Code Completion
12769  /// Implementations are in SemaCodeComplete.cpp
12770  ///@{
12771 
12772 public:
12773  /// Code-completion consumer.
12775 
12776  /// Describes the context in which code completion occurs.
12778  /// Code completion occurs at top-level or namespace context.
12780  /// Code completion occurs within a class, struct, or union.
12782  /// Code completion occurs within an Objective-C interface, protocol,
12783  /// or category.
12785  /// Code completion occurs within an Objective-C implementation or
12786  /// category implementation
12788  /// Code completion occurs within the list of instance variables
12789  /// in an Objective-C interface, protocol, category, or implementation.
12791  /// Code completion occurs following one or more template
12792  /// headers.
12794  /// Code completion occurs following one or more template
12795  /// headers within a class.
12797  /// Code completion occurs within an expression.
12799  /// Code completion occurs within a statement, which may
12800  /// also be an expression or a declaration.
12802  /// Code completion occurs at the beginning of the
12803  /// initialization statement (or expression) in a for loop.
12805  /// Code completion occurs within the condition of an if,
12806  /// while, switch, or for statement.
12808  /// Code completion occurs within the body of a function on a
12809  /// recovery path, where we do not have a specific handle on our position
12810  /// in the grammar.
12812  /// Code completion occurs where only a type is permitted.
12814  /// Code completion occurs in a parenthesized expression, which
12815  /// might also be a type cast.
12817  /// Code completion occurs within a sequence of declaration
12818  /// specifiers within a function, method, or block.
12820  /// Code completion occurs at top-level in a REPL session
12822  };
12823 
12826  ParserCompletionContext CompletionContext);
12827  void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, bool AllowNonIdentifiers,
12828  bool AllowNestedNameSpecifiers);
12829 
12830  struct CodeCompleteExpressionData;
12831  void CodeCompleteExpression(Scope *S, const CodeCompleteExpressionData &Data);
12832  void CodeCompleteExpression(Scope *S, QualType PreferredType,
12833  bool IsParenthesized = false);
12834  void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, Expr *OtherOpBase,
12835  SourceLocation OpLoc, bool IsArrow,
12836  bool IsBaseExprStatement,
12837  QualType PreferredType);
12839  QualType PreferredType);
12840  void CodeCompleteTag(Scope *S, unsigned TagSpec);
12843  const VirtSpecifiers *VS = nullptr);
12845  void CodeCompleteCase(Scope *S);
12846  enum class AttributeCompletion {
12847  Attribute,
12848  Scope,
12849  None,
12850  };
12851  void CodeCompleteAttribute(
12854  const IdentifierInfo *Scope = nullptr);
12855  /// Determines the preferred type of the current function argument, by
12856  /// examining the signatures of all possible overloads.
12857  /// Returns null if unknown or ambiguous, or if code completion is off.
12858  ///
12859  /// If the code completion point has been reached, also reports the function
12860  /// signatures that were considered.
12861  ///
12862  /// FIXME: rename to GuessCallArgumentType to reduce confusion.
12864  SourceLocation OpenParLoc);
12866  ArrayRef<Expr *> Args,
12867  SourceLocation OpenParLoc,
12868  bool Braced);
12870  Decl *ConstructorDecl, CXXScopeSpec SS, ParsedType TemplateTypeTy,
12871  ArrayRef<Expr *> ArgExprs, IdentifierInfo *II, SourceLocation OpenParLoc,
12872  bool Braced);
12875  void CodeCompleteInitializer(Scope *S, Decl *D);
12876  /// Trigger code completion for a record of \p BaseType. \p InitExprs are
12877  /// expressions in the initializer list seen so far and \p D is the current
12878  /// Designation being parsed.
12879  void CodeCompleteDesignator(const QualType BaseType,
12880  llvm::ArrayRef<Expr *> InitExprs,
12881  const Designation &D);
12882  void CodeCompleteAfterIf(Scope *S, bool IsBracedThen);
12883 
12884  void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext,
12885  bool IsUsingDeclaration, QualType BaseType,
12886  QualType PreferredType);
12887  void CodeCompleteUsing(Scope *S);
12893  Decl *Constructor, ArrayRef<CXXCtorInitializer *> Initializers);
12894 
12896  bool AfterAmpersand);
12898 
12907  bool IsParameter);
12911  bool AtArgumentExpression);
12912  void CodeCompleteObjCClassMessage(Scope *S, ParsedType Receiver,
12914  bool AtArgumentExpression,
12915  bool IsSuper = false);
12917  Scope *S, Expr *Receiver, ArrayRef<const IdentifierInfo *> SelIdents,
12918  bool AtArgumentExpression, ObjCInterfaceDecl *Super = nullptr);
12919  void CodeCompleteObjCForCollection(Scope *S, DeclGroupPtrTy IterationVar);
12922  void
12927  void CodeCompleteObjCSuperclass(Scope *S, IdentifierInfo *ClassName,
12928  SourceLocation ClassNameLoc);
12931  SourceLocation ClassNameLoc);
12933  IdentifierInfo *ClassName,
12934  SourceLocation ClassNameLoc);
12937  IdentifierInfo *PropertyName);
12939  std::optional<bool> IsInstanceMethod,
12940  ParsedType ReturnType);
12942  Scope *S, bool IsInstanceMethod, bool AtParameterName,
12943  ParsedType ReturnType, ArrayRef<const IdentifierInfo *> SelIdents);
12945  const IdentifierInfo &ClassName,
12946  SourceLocation ClassNameLoc,
12947  bool IsBaseExprStatement);
12948  void CodeCompletePreprocessorDirective(bool InConditional);
12950  void CodeCompletePreprocessorMacroName(bool IsDefinition);
12954  unsigned Argument);
12955  void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled);
12958  void
12960  CodeCompletionTUInfo &CCTUInfo,
12962 
12963  ///@}
12964 
12965  //
12966  //
12967  // -------------------------------------------------------------------------
12968  //
12969  //
12970 
12971  /// \name FixIt Helpers
12972  /// Implementations are in SemaFixItUtils.cpp
12973  ///@{
12974 
12975 public:
12976  /// Get a string to suggest for zero-initialization of a type.
12978  SourceLocation Loc) const;
12979  std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const;
12980 
12981  ///@}
12982 
12983  //
12984  //
12985  // -------------------------------------------------------------------------
12986  //
12987  //
12988 
12989  /// \name API Notes
12990  /// Implementations are in SemaAPINotes.cpp
12991  ///@{
12992 
12993 public:
12994  /// Map any API notes provided for this declaration to attributes on the
12995  /// declaration.
12996  ///
12997  /// Triggered by declaration-attribute processing.
12998  void ProcessAPINotes(Decl *D);
12999 
13000  ///@}
13001  //
13002  //
13003  // -------------------------------------------------------------------------
13004  //
13005  //
13006 
13007  /// \name Name Lookup for RISC-V Vector Intrinsic
13008  /// Implementations are in SemaRISCVVectorLookup.cpp
13009  ///@{
13010 
13011 public:
13012  /// Indicate RISC-V vector builtin functions enabled or not.
13014 
13015  /// Indicate RISC-V SiFive vector builtin functions enabled or not.
13017 
13018 private:
13019  std::unique_ptr<sema::RISCVIntrinsicManager> RVIntrinsicManager;
13020 
13021  ///@}
13022 };
13023 
13027 
13028 /// Contains a late templated function.
13029 /// Will be parsed at the end of the translation unit, used by Sema & Parser.
13032  /// The template function declaration to be late parsed.
13034  /// Floating-point options in the point of definition.
13036 };
13037 
13038 template <>
13040  PragmaMsStackAction Action,
13041  llvm::StringRef StackSlotLabel,
13043 
13044 std::unique_ptr<sema::RISCVIntrinsicManager>
13046 } // end namespace clang
13047 
13048 #endif
This file provides AST data structures related to concepts.
#define V(N, I)
Definition: ASTContext.h:3278
int Depth
Definition: ASTDiff.cpp:190
int Id
Definition: ASTDiff.cpp:190
Forward declaration of all AST node types.
StringRef P
static char ID
Definition: Arena.cpp:183
#define SM(sm)
Definition: Cuda.cpp:82
Provides LLVM's BitmaskEnum facility to enumeration types declared in namespace clang.
Defines enum values for all the target-independent builtin functions.
static void emit(Program &P, std::vector< std::byte > &Code, const T &Val, bool &Success)
Helper to write bytecode and bail out if 32-bit offsets become invalid.
llvm::APSInt APSInt
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
Defines enumerations for expression traits intrinsics.
int Priority
Definition: Format.cpp:2976
unsigned Offset
Definition: Format.cpp:2974
StringRef Identifier
Definition: Format.cpp:2980
llvm::MachO::Target Target
Definition: MachO.h:48
llvm::MachO::Record Record
Definition: MachO.h:31
Defines the clang::Module class, which describes a module in the source code.
Defines the clang::OpenCLOptions class.
RedeclarationKind
Specifies whether (or how) name lookup is being performed for a redeclaration (vs.
Definition: Redeclaration.h:18
@ NotForRedeclaration
The lookup is a reference to this name that is not for the purpose of redeclaring the name.
AccessResult
A copy of Sema's enum without AR_delayed.
Definition: SemaAccess.cpp:31
CastType
Definition: SemaCast.cpp:48
Sema::AllowedExplicit AllowedExplicit
Defines various enumerations that describe declaration and type specifiers.
const char * Data
Defines the clang::TemplateNameKind enum.
Defines the clang::TypeLoc interface and its subclasses.
Allows QualTypes to be sorted and hence used in maps and sets.
Defines enumerations for the type traits support.
TypePropertyCache< Private > Cache
Definition: Type.cpp:4405
SourceLocation End
SourceLocation Begin
StateNode * Previous
std::string Label
__SIZE_TYPE__ size_t
A class for storing results from argument-dependent lookup.
Definition: Lookup.h:867
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition: APValue.h:122
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
Definition: ASTConsumer.h:33
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:182
CanQualType BoolTy
Definition: ASTContext.h:1092
CanQualType IntTy
Definition: ASTContext.h:1100
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:366
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:86
Represents an access specifier followed by colon ':'.
Definition: DeclCXX.h:86
PtrTy get() const
Definition: Ownership.h:170
bool isInvalid() const
Definition: Ownership.h:166
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition: Expr.h:2716
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:3318
Attr - This represents one attribute.
Definition: Attr.h:46
Syntax
The style used to specify an attribute.
An attributed type is a type to which a type attribute has been applied.
Definition: Type.h:5404
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
Definition: Type.h:5781
Represents a C++ declaration that introduces decls from somewhere else.
Definition: DeclCXX.h:3414
A binding in a decomposition declaration.
Definition: DeclCXX.h:4104
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4496
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
Represents a base class of a C++ class.
Definition: DeclCXX.h:146
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2532
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2859
Represents a C++ base or member initializer.
Definition: DeclCXX.h:2297
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition: ExprCXX.h:2491
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2796
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2057
Represents a C++ struct/union/class.
Definition: DeclCXX.h:258
Represents a C++ nested-name-specifier or a global scope specifier.
Definition: DeclSpec.h:73
Represents the this expression in C++.
Definition: ExprCXX.h:1148
CXXTryStmt - A C++ try block, including all handlers.
Definition: StmtCXX.h:69
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2872
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4688
CaseStmt - Represent a case statement.
Definition: Stmt.h:1801
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3535
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
Declaration of a class template.
Represents a class template specialization, which refers to a class template with a given set of temp...
Abstract interface for a consumer of code-completion information.
An allocator used specifically for the purpose of code completion.
Declaration of a C++20 concept.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition: ASTConcept.h:35
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:3595
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
The information about the darwin SDK that was used during this compilation.
Definition: DarwinSDKInfo.h:29
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
The results of name lookup within a DeclContext.
Definition: DeclBase.h:1371
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1438
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1260
Captures information about "declaration specifiers".
Definition: DeclSpec.h:246
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:85
bool isUnconditionallyVisible() const
Determine whether this declaration is definitely visible to name lookup, independent of whether the o...
Definition: DeclBase.h:851
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:970
SourceLocation getLocation() const
Definition: DeclBase.h:447
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
Definition: DeclBase.h:910
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition: DeclBase.h:835
DeclContext * getDeclContext()
Definition: DeclBase.h:456
The name of a declaration.
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:771
Information about one declarator, including the parsed type information and the identifier.
Definition: DeclSpec.h:1898
A decomposition declaration.
Definition: DeclCXX.h:4163
A dependently-generated diagnostic.
Designation - Represent a full designation, which is a sequence of designators.
Definition: Designator.h:208
Concrete class used by the front-end to report problems and issues.
Definition: Diagnostic.h:193
void setLastDiagnosticIgnored(bool Ignored)
Pretend that the last diagnostic issued was ignored, so any subsequent notes will be suppressed,...
Definition: Diagnostic.h:767
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:3299
Represents an enum.
Definition: Decl.h:3869
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
Definition: Type.h:5375
Store information needed for an explicit specifier.
Definition: DeclCXX.h:1896
The return type of classify().
Definition: Expr.h:330
This represents one expression.
Definition: Expr.h:110
NullPointerConstantKind
Enumeration used to describe the kind of Null pointer constant returned from isNullPointerConstant().
Definition: Expr.h:792
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition: Expr.cpp:277
An abstract interface that should be implemented by external AST sources that also provide informatio...
virtual void ReadTentativeDefinitions(SmallVectorImpl< VarDecl * > &TentativeDefs)
Read the set of tentative definitions known to the external Sema source.
virtual void ReadUnusedFileScopedDecls(SmallVectorImpl< const DeclaratorDecl * > &Decls)
Read the set of unused file-scope declarations known to the external Sema source.
virtual void ReadExtVectorDecls(SmallVectorImpl< TypedefNameDecl * > &Decls)
Read the set of ext_vector type declarations known to the external Sema source.
virtual void ReadDelegatingConstructors(SmallVectorImpl< CXXConstructorDecl * > &Decls)
Read the set of delegating constructors known to the external Sema source.
Represents difference between two FPOptions values.
Definition: LangOptions.h:949
FPOptionsOverride getChangesFrom(const FPOptions &Base) const
Return difference with the given option set.
Definition: LangOptions.h:1059
Represents a member of a struct/union/class.
Definition: Decl.h:3059
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
A mapping from file IDs to a record of whether we've seen nullability information in that file.
Definition: Sema.h:267
FileNullability & operator[](FileID file)
Definition: Sema.h:278
FileNullability Nullability
Definition: Sema.h:274
Represents a function declaration or definition.
Definition: Decl.h:1972
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition: ExprCXX.h:4606
Represents a prototype with parameter type info, e.g.
Definition: Type.h:4456
Declaration of a template function.
Definition: DeclTemplate.h:958
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
Definition: Type.h:4082
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:4056
One of these records is kept for each identifier that is lexed.
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
Definition: Overload.h:543
Represents a field injected from an anonymous union/struct into the parent scope.
Definition: Decl.h:3343
Describes an C or C++ initializer list.
Definition: Expr.h:4888
Describes the kind of initialization being performed, along with location information for tokens rela...
Describes the sequence of initializations required to initialize a given object or reference with a s...
Describes an entity that is being initialized.
Represents the declaration of a label.
Definition: Decl.h:500
ComplexRangeKind
Controls the various implementations for complex multiplication and.
Definition: LangOptions.h:427
FPEvalMethodKind
Possible float expression evaluation method choices.
Definition: LangOptions.h:292
FPExceptionModeKind
Possible floating point exception behavior.
Definition: LangOptions.h:280
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:475
Represents a lazily-loaded vector of data.
A stack-allocated class that identifies which local variable declaration instantiations are present i...
Definition: Template.h:365
Represents the results of name lookup.
Definition: Lookup.h:46
A global _GUID constant.
Definition: DeclCXX.h:4286
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:4232
Encapsulates the data about a macro definition (e.g.
Definition: MacroInfo.h:39
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition: ExprCXX.h:4686
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:3224
Abstract interface for a module loader.
Definition: ModuleLoader.h:82
Describes a module or submodule.
Definition: Module.h:105
Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent, bool IsFramework, bool IsExplicit, unsigned VisibilityID)
Construct a new module or submodule.
Definition: Module.cpp:37
Data structure that captures multiple levels of template argument lists for use in template instantia...
Definition: Template.h:76
static const unsigned NumNSNumberLiteralMethods
Definition: NSAPI.h:191
This represents a decl that may have a name.
Definition: Decl.h:249
bool isExternallyDeclarable() const
Determine whether this declaration can be redeclared in a different translation unit.
Definition: Decl.h:415
Represent a C++ namespace.
Definition: Decl.h:548
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2323
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Definition: DeclObjC.h:2539
ObjCContainerDecl - Represents a container for method declarations.
Definition: DeclObjC.h:946
Captures information about "declaration specifiers" specific to Objective-C.
Definition: DeclSpec.h:896
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2590
Represents an ObjC class declaration.
Definition: DeclObjC.h:1152
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1948
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:945
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:140
Represents a pointer to an Objective C object.
Definition: Type.h:6808
Represents a class type in Objective C.
Definition: Type.h:6554
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:729
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2079
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:578
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition: DeclObjC.h:658
Wrapper for void* pointer.
Definition: Ownership.h:50
static OpaquePtr make(QualType P)
Definition: Ownership.h:60
OpenCL supported extensions and optional core features.
Definition: OpenCLOptions.h:69
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13....
Definition: Overload.h:980
ParenExpr - This represents a parethesized expression, e.g.
Definition: Expr.h:2182
Represents a parameter to a function.
Definition: Decl.h:1762
ParsedAttr - Represents a syntactic attribute.
Definition: ParsedAttr.h:126
ParsedAttributes - A collection of parsed attributes.
Definition: ParsedAttr.h:951
Represents the parsed form of a C++ template argument.
Parser - This implements a parser for the C family of languages.
Definition: Parser.h:56
Tracks expected type during expression parsing, for use in code completion.
Definition: Sema.h:299
void enterFunctionArgument(SourceLocation Tok, llvm::function_ref< QualType()> ComputeType)
Computing a type for the function argument may require running overloading, so we postpone its comput...
void enterCondition(Sema &S, SourceLocation Tok)
void enterTypeCast(SourceLocation Tok, QualType CastType)
Handles all type casts, including C-style cast, C++ casts, etc.
void enterMemAccess(Sema &S, SourceLocation Tok, Expr *Base)
void enterSubscript(Sema &S, SourceLocation Tok, Expr *LHS)
void enterUnary(Sema &S, SourceLocation Tok, tok::TokenKind OpKind, SourceLocation OpLoc)
void enterReturn(Sema &S, SourceLocation Tok)
void enterDesignatedInitializer(SourceLocation Tok, QualType BaseType, const Designation &D)
Handles e.g. BaseType{ .D = Tok...
void enterBinary(Sema &S, SourceLocation Tok, Expr *LHS, tok::TokenKind Op)
void enterParenExpr(SourceLocation Tok, SourceLocation LParLoc)
PreferredTypeBuilder(bool Enabled)
Definition: Sema.h:301
void enterVariableInit(SourceLocation Tok, Decl *D)
QualType get(SourceLocation Tok) const
Get the expected type associated with this location, if any.
Definition: Sema.h:336
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Definition: Preprocessor.h:128
Stores the type being destroyed by a pseudo-destructor expression.
Definition: ExprCXX.h:2559
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition: Expr.h:6346
A (possibly-)qualified type.
Definition: Type.h:738
The collection of all-type qualifiers we support.
Definition: Type.h:148
Represents a struct/union/class.
Definition: Decl.h:4170
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:5349
Represents the body of a requires-expression.
Definition: DeclCXX.h:2027
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Definition: ExprConcepts.h:510
Scope - A scope is a transient data structure that is used while parsing the program.
Definition: Scope.h:41
void incrementMSManglingNumber()
Definition: Scope.h:352
Smart pointer class that efficiently represents Objective-C method names.
A generic diagnostic builder for errors which may or may not be deferred.
Definition: SemaBase.h:175
llvm::DenseMap< CanonicalDeclPtr< const FunctionDecl >, std::vector< DeviceDeferredDiagnostic > > DeferredDiagnosticsType
Definition: SemaBase.h:264
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
Definition: SemaBase.cpp:57
DeviceDiagnosticReason
Bitmask to contain the list of reasons a single diagnostic should be emitted, based on its language.
Definition: SemaBase.h:99
Sema & SemaRef
Definition: SemaBase.h:40
AlignPackInfo(AlignPackInfo::Mode M, unsigned Num, bool IsXL)
Definition: Sema.h:1217
bool operator==(const AlignPackInfo &Info) const
Definition: Sema.h:1277
static AlignPackInfo getFromRawEncoding(unsigned Encoding)
Definition: Sema.h:1249
unsigned getPackNumber() const
Definition: Sema.h:1267
bool IsXLStack() const
Definition: Sema.h:1275
bool IsPackSet() const
Definition: Sema.h:1269
AlignPackInfo(AlignPackInfo::Mode M, bool IsXL)
Definition: Sema.h:1223
bool IsAlignAttr() const
Definition: Sema.h:1263
bool IsPackAttr() const
Definition: Sema.h:1261
bool operator!=(const AlignPackInfo &Info) const
Definition: Sema.h:1283
AlignPackInfo(bool IsXL)
Definition: Sema.h:1227
static uint32_t getRawEncoding(const AlignPackInfo &Info)
Definition: Sema.h:1234
Mode getAlignMode() const
Definition: Sema.h:1265
RAII object used to change the argument pack substitution index within a Sema object.
Definition: Sema.h:10498
ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex)
Definition: Sema.h:10503
BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
Definition: Sema.h:6569
void diagnose(Sema &S, SourceLocation Loc, QualType T) override
Definition: Sema.h:6574
void emit(const SemaDiagnosticBuilder &DB, std::index_sequence< Is... >) const
Definition: Sema.h:6561
std::tuple< const Ts &... > Args
Definition: Sema.h:6558
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
Definition: Sema.h:6721
A RAII object to enter scope of a compound statement.
Definition: Sema.h:866
CompoundScopeRAII(Sema &S, bool IsStmtExpr=false)
Definition: Sema.h:868
std::pair< VarDecl *, Expr * > get() const
Definition: Sema.h:6048
bool isInvalid() const
Definition: Sema.h:6047
std::optional< bool > getKnownValue() const
Definition: Sema.h:6052
A RAII object to temporarily push a declaration context.
Definition: Sema.h:2552
ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext=true)
Definition: Sema.h:2562
Abstract base class used to perform a contextual implicit conversion from an expression to any type p...
Definition: Sema.h:8225
virtual SemaDiagnosticBuilder noteAmbiguous(Sema &S, CXXConversionDecl *Conv, QualType ConvTy)=0
Emits a note for one of the candidate conversions.
virtual SemaDiagnosticBuilder diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic complaining that the expression does not have integral or enumeration type.
virtual SemaDiagnosticBuilder noteExplicitConv(Sema &S, CXXConversionDecl *Conv, QualType ConvTy)=0
Emits a note for the explicit conversion function.
virtual SemaDiagnosticBuilder diagnoseExplicitConv(Sema &S, SourceLocation Loc, QualType T, QualType ConvTy)=0
Emits a diagnostic when the only matching conversion function is explicit.
virtual SemaDiagnosticBuilder diagnoseConversion(Sema &S, SourceLocation Loc, QualType T, QualType ConvTy)=0
Emits a diagnostic when we picked a conversion function (for cases when we are not allowed to pick a ...
virtual SemaDiagnosticBuilder diagnoseAmbiguous(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic when there are multiple possible conversion functions.
ContextualImplicitConverter(bool Suppress=false, bool SuppressConversion=false)
Definition: Sema.h:8230
virtual bool match(QualType T)=0
Determine whether the specified type is a valid destination type for this conversion.
virtual SemaDiagnosticBuilder diagnoseIncomplete(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic when the expression has incomplete class type.
For a defaulted function, the kind of defaulted function that it is.
Definition: Sema.h:4850
DefaultedComparisonKind asComparison() const
Definition: Sema.h:4882
DefaultedFunctionKind(CXXSpecialMemberKind CSM)
Definition: Sema.h:4859
unsigned getDiagnosticIndex() const
Get the index of this function kind for use in diagnostics.
Definition: Sema.h:4887
DefaultedFunctionKind(DefaultedComparisonKind Comp)
Definition: Sema.h:4862
CXXSpecialMemberKind asSpecialMember() const
Definition: Sema.h:4879
RAII class to control scope of DeferDiags.
Definition: Sema.h:8074
DeferDiagsRAII(Sema &S, bool DeferDiags)
Definition: Sema.h:8079
A class which encapsulates the logic for delaying diagnostics during parsing and other processing.
Definition: Sema.h:938
sema::DelayedDiagnosticPool * getCurrentPool() const
Returns the current delayed-diagnostics pool.
Definition: Sema.h:953
DelayedDiagnosticsState push(sema::DelayedDiagnosticPool &pool)
Enter a new scope.
Definition: Sema.h:957
void popUndelayed(DelayedDiagnosticsState state)
Undo a previous pushUndelayed().
Definition: Sema.h:981
bool shouldDelayDiagnostics()
Determines whether diagnostics should be delayed.
Definition: Sema.h:950
void add(const sema::DelayedDiagnostic &diag)
Adds a delayed diagnostic.
void popWithoutEmitting(DelayedDiagnosticsState state)
Leave a delayed-diagnostic state that was previously pushed.
Definition: Sema.h:967
DelayedDiagnosticsState pushUndelayed()
Enter a new scope where access and deprecation diagnostics are not delayed.
Definition: Sema.h:973
A helper class for building up ExtParameterInfos.
Definition: Sema.h:9951
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
Definition: Sema.h:9970
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Definition: Sema.h:9958
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Definition: Sema.h:10749
FPOptionsOverride getOverrides()
Definition: Sema.h:10753
FullExprArg(Sema &actions)
Definition: Sema.h:5992
ExprResult release()
Definition: Sema.h:5994
Expr * get() const
Definition: Sema.h:5996
GlobalEagerInstantiationScope(Sema &S, bool Enabled)
Definition: Sema.h:10765
llvm::DenseMap< Selector, Lists >::iterator iterator
Definition: Sema.h:12013
iterator find(Selector Sel)
Definition: Sema.h:12016
std::pair< ObjCMethodList, ObjCMethodList > Lists
Definition: Sema.h:12012
std::pair< iterator, bool > insert(std::pair< Selector, Lists > &&Val)
Definition: Sema.h:12017
int count(Selector Sel) const
Definition: Sema.h:12020
SemaDiagnosticBuilder diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T) override
Emits a diagnostic complaining that the expression does not have integral or enumeration type.
Definition: Sema.h:8289
virtual SemaDiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic complaining that the expression does not have integral or enumeration type.
ICEConvertDiagnoser(bool AllowScopedEnumerations, bool Suppress, bool SuppressConversion)
Definition: Sema.h:8281
Helper class that collects exception specifications for implicitly-declared special member functions.
Definition: Sema.h:4189
unsigned size() const
The number of exceptions in the exception specification.
Definition: Sema.h:4222
ExceptionSpecificationType getExceptionSpecType() const
Get the computed exception specification type.
Definition: Sema.h:4215
void CalledExpr(Expr *E)
Integrate an invoked expression into the collected data.
Definition: Sema.h:4231
const QualType * data() const
The set of exceptions in the exception specification.
Definition: Sema.h:4225
FunctionProtoType::ExceptionSpecInfo getExceptionSpec() const
Overwrite an EPI's exception specification with this computed exception specification.
Definition: Sema.h:4238
static NameClassification DependentNonType()
Definition: Sema.h:2767
static NameClassification VarTemplate(TemplateName Name)
Definition: Sema.h:2777
ExprResult getExpression() const
Definition: Sema.h:2803
NameClassification(const IdentifierInfo *Keyword)
Definition: Sema.h:2743
static NameClassification Unknown()
Definition: Sema.h:2747
static NameClassification OverloadSet(ExprResult E)
Definition: Sema.h:2751
NameClassificationKind getKind() const
Definition: Sema.h:2801
static NameClassification UndeclaredTemplate(TemplateName Name)
Definition: Sema.h:2795
static NameClassification FunctionTemplate(TemplateName Name)
Definition: Sema.h:2783
NameClassification(ParsedType Type)
Definition: Sema.h:2741
TemplateName getTemplateName() const
Definition: Sema.h:2818
ParsedType getType() const
Definition: Sema.h:2808
TemplateNameKind getTemplateNameKind() const
Definition: Sema.h:2825
static NameClassification NonType(NamedDecl *D)
Definition: Sema.h:2757
static NameClassification Concept(TemplateName Name)
Definition: Sema.h:2789
static NameClassification UndeclaredNonType()
Definition: Sema.h:2763
NamedDecl * getNonTypeDecl() const
Definition: Sema.h:2813
static NameClassification TypeTemplate(TemplateName Name)
Definition: Sema.h:2771
static NameClassification Error()
Definition: Sema.h:2745
Custom deleter to allow FunctionScopeInfos to be kept alive for a short time after they've been poppe...
Definition: Sema.h:640
void operator()(sema::FunctionScopeInfo *Scope) const
Definition: Sema.cpp:2368
PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct)
Definition: SemaAttr.cpp:28
Whether and why a template name is required in this lookup.
Definition: Sema.h:9047
RequiredTemplateKind(TemplateNameIsRequiredTag)
Template name is unconditionally required.
Definition: Sema.h:9053
SourceLocation getTemplateKeywordLoc() const
Definition: Sema.h:9055
RequiredTemplateKind(SourceLocation TemplateKWLoc=SourceLocation())
Template name is required if TemplateKWLoc is valid.
Definition: Sema.h:9050
bool hasTemplateKeyword() const
Definition: Sema.h:9058
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
Definition: Sema.h:9701
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
Definition: Sema.h:9731
SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE=false)
Definition: Sema.h:9709
A derivative of BoundTypeDiagnoser for which the diagnostic's type parameter is preceded by a 0/1 enu...
Definition: Sema.h:6586
void diagnose(Sema &S, SourceLocation Loc, QualType T) override
Definition: Sema.h:6591
SizelessTypeDiagnoser(unsigned DiagID, const Ts &...Args)
Definition: Sema.h:6588
SpecialMemberOverloadResultEntry(const llvm::FoldingSetNodeID &ID)
Definition: Sema.h:7519
SpecialMemberOverloadResult - The overloading result for a special member function.
Definition: Sema.h:7497
SpecialMemberOverloadResult(CXXMethodDecl *MD)
Definition: Sema.h:7506
void setMethod(CXXMethodDecl *MD)
Definition: Sema.h:7510
CXXMethodDecl * getMethod() const
Definition: Sema.h:7509
RAII object to handle the state changes required to synthesize a function body.
Definition: Sema.h:10378
void addContextNote(SourceLocation UseLoc)
Definition: Sema.h:10404
SynthesizedFunctionScope(Sema &S, DeclContext *DC)
Definition: Sema.h:10384
SourceLocation getLocation() const
Definition: Sema.h:9531
const DeclContext * getLexicalDeclContext() const
Definition: Sema.h:9523
bool ContainsDecl(const NamedDecl *ND) const
Definition: Sema.h:9521
const NamedDecl * getDecl() const
Definition: Sema.h:9519
TemplateCompareNewDeclInfo(const DeclContext *DeclCtx, const DeclContext *LexicalDeclCtx, SourceLocation Loc)
Definition: Sema.h:9505
TemplateCompareNewDeclInfo(const NamedDecl *ND)
Definition: Sema.h:9504
const DeclContext * getDeclContext() const
Definition: Sema.h:9527
RAII class used to indicate that we are performing provisional semantic analysis to determine the val...
Definition: Sema.h:9740
TentativeAnalysisScope(Sema &SemaRef)
Definition: Sema.h:9747
Abstract base class used for diagnosing integer constant expression violations.
Definition: Sema.h:5945
virtual SemaDiagnosticBuilder diagnoseNotICE(Sema &S, SourceLocation Loc)=0
VerifyICEDiagnoser(bool Suppress=false)
Definition: Sema.h:5949
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:458
void AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI, RetainOwnershipKind K, bool IsTemplateInstantiation)
FunctionDecl * FindUsualDeallocationFunction(SourceLocation StartLoc, bool CanProvideSize, bool Overaligned, DeclarationName Name)
const FieldDecl * getSelfAssignmentClassMemberCandidate(const ValueDecl *SelfAssigned)
Returns a field in a CXXRecordDecl that has the same name as the decl SelfAssigned when inside a CXXM...
Definition: SemaExpr.cpp:14915
void DeclareGlobalNewDelete()
DeclareGlobalNewDelete - Declare the global forms of operator new and delete.
StmtResult ActOnCXXForRangeIdentifier(Scope *S, SourceLocation IdentLoc, IdentifierInfo *Ident, ParsedAttributes &Attrs)
Definition: SemaDecl.cpp:14501
void DefineImplicitLambdaToFunctionPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a function pointer.
bool CheckInstantiatedFunctionTemplateConstraints(SourceLocation PointOfInstantiation, FunctionDecl *Decl, ArrayRef< TemplateArgument > TemplateArgs, ConstraintSatisfaction &Satisfaction)
QualType CheckSizelessVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
bool hasReachableDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a reachable definition.
Definition: SemaType.cpp:9507
QualType SubstAutoType(QualType TypeWithAuto, QualType Replacement)
Substitute Replacement for auto in TypeWithAuto.
CXXConstructorDecl * DeclareImplicitDefaultConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit default constructor for the given class.
ObjCMethodDecl * LookupMethodInObjectType(Selector Sel, QualType Ty, bool IsInstance)
LookupMethodInType - Look up a method in an ObjCObjectType.
bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old, Scope *S)
MergeCXXFunctionDecl - Merge two declarations of the same C++ function, once we already know that the...
Attr * getImplicitCodeSegOrSectionAttrForFunction(const FunctionDecl *FD, bool IsDefinition)
Returns an implicit CodeSegAttr if a __declspec(code_seg) is found on a containing class.
Definition: SemaDecl.cpp:11200
ExprResult PerformImplicitObjectArgumentInitialization(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, CXXMethodDecl *Method)
PerformObjectArgumentInitialization - Perform initialization of the implicit object parameter for the...
QualType BuildParenType(QualType T)
Build a paren type including T.
Definition: SemaType.cpp:2074
void CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI, SmallVectorImpl< ObjCIvarDecl * > &Ivars)
CollectIvarsToConstructOrDestruct - Collect those ivars which require initialization.
MemInitResult BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init, CXXRecordDecl *ClassDecl)
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
Definition: SemaType.cpp:6820
void CheckTypedefForVariablyModifiedType(Scope *S, TypedefNameDecl *D)
Definition: SemaDecl.cpp:6886
ExprResult ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXTypeid - Parse typeid( something ).
QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage)
Determine the result of a message send expression based on the type of the receiver,...
llvm::DenseSet< Module * > LookupModulesCache
Cache of additional modules that should be used for name lookup within the current template instantia...
Definition: Sema.h:10448
void ActOnObjCContainerStartDefinition(ObjCContainerDecl *IDecl)
Definition: SemaDecl.cpp:18449
void ActOnPragmaMSOptimize(SourceLocation Loc, bool IsOn)
#pragma optimize("[optimization-list]", on | off).
Definition: SemaAttr.cpp:1158
VarTemplateSpecializationDecl * BuildVarTemplateInstantiation(VarTemplateDecl *VarTemplate, VarDecl *FromVar, const TemplateArgumentList *PartialSpecArgs, const TemplateArgumentListInfo &TemplateArgsInfo, SmallVectorImpl< TemplateArgument > &Converted, SourceLocation PointOfInstantiation, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *StartingScope=nullptr)
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
bool SubstTypeConstraint(TemplateTypeParmDecl *Inst, const TypeConstraint *TC, const MultiLevelTemplateArgumentList &TemplateArgs, bool EvaluateConstraint)
DeclResult ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, SourceLocation ModulePrivateLoc, CXXScopeSpec &SS, TemplateIdAnnotation &TemplateId, const ParsedAttributesView &Attr, MultiTemplateParamsArg TemplateParameterLists, SkipBodyInfo *SkipBody=nullptr)
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(const NamedDecl *D, const DeclContext *DC=nullptr, bool Final=false, std::optional< ArrayRef< TemplateArgument >> Innermost=std::nullopt, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr, bool ForConstraintInstantiation=false, bool SkipForSpecialization=false)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
ExprResult ActOnCXXUuidof(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXUuidof - Parse __uuidof( something ).
bool EvaluateStaticAssertMessageAsString(Expr *Message, std::string &Result, ASTContext &Ctx, bool ErrorOnInvalidMessage)
bool CheckSpecifiedExceptionType(QualType &T, SourceRange Range)
CheckSpecifiedExceptionType - Check if the given type is valid in an exception specification.
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
bool ConstantFoldAttrArgs(const AttributeCommonInfo &CI, MutableArrayRef< Expr * > Args)
ConstantFoldAttrArgs - Folds attribute arguments into ConstantExprs (unless they are value dependent ...
Definition: SemaAttr.cpp:400
ExprResult BuildBlockForLambdaConversion(SourceLocation CurrentLocation, SourceLocation ConvLocation, CXXConversionDecl *Conv, Expr *Src)
SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
Definition: Sema.h:10432
bool IsPointerInterconvertibleBaseOf(const TypeSourceInfo *Base, const TypeSourceInfo *Derived)
bool diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function, const Expr *ThisArg, ArrayRef< const Expr * > Args, SourceLocation Loc)
Emit diagnostics for the diagnose_if attributes on Function, ignoring any non-ArgDependent DiagnoseIf...
void CodeCompleteObjCMethodDeclSelector(Scope *S, bool IsInstanceMethod, bool AtParameterName, ParsedType ReturnType, ArrayRef< const IdentifierInfo * > SelIdents)
ExprResult PerformContextuallyConvertToObjCPointer(Expr *From)
PerformContextuallyConvertToObjCPointer - Perform a contextual conversion of the expression From to a...
bool buildOverloadedCallSet(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, MultiExprArg Args, SourceLocation RParenLoc, OverloadCandidateSet *CandidateSet, ExprResult *Result)
Constructs and populates an OverloadedCandidateSet from the given function.
SmallVector< Scope *, 2 > CurrentSEHFinally
Stack of active SEH __finally scopes. Can be empty.
Definition: Sema.h:8653
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
Definition: Sema.h:12008
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
Definition: Sema.h:9980
void CheckFloatComparison(SourceLocation Loc, Expr *LHS, Expr *RHS, BinaryOperatorKind Opcode)
Check for comparisons of floating-point values using == and !=.
Decl * ActOnAliasDeclaration(Scope *CurScope, AccessSpecifier AS, MultiTemplateParamsArg TemplateParams, SourceLocation UsingLoc, UnqualifiedId &Name, const ParsedAttributesView &AttrList, TypeResult Type, Decl *DeclFromDeclSpec)
void MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New, LookupResult &OldDecls)
MergeTypedefNameDecl - We just parsed a typedef 'New' which has the same name and scope as a previous...
Definition: SemaDecl.cpp:2584
InternalLinkageAttr * mergeInternalLinkageAttr(Decl *D, const ParsedAttr &AL)
bool hasStructuralCompatLayout(Decl *D, Decl *Suggested)
Determine if D and Suggested have a structurally compatible layout as described in C11 6....
Definition: SemaType.cpp:9382
void RegisterLocallyScopedExternCDecl(NamedDecl *ND, Scope *S)
Register the given locally-scoped extern "C" declaration so that it can be found later for redeclarat...
Definition: SemaDecl.cpp:6804
void GatherGlobalCodeCompletions(CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, SmallVectorImpl< CodeCompletionResult > &Results)
bool isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New)
Definition: SemaDecl.cpp:2545
SmallVector< SmallVector< VTableUse, 16 >, 8 > SavedVTableUses
Definition: Sema.h:10712
void CodeCompleteObjCProtocolDecl(Scope *S)
NamedDecl * ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope)
Definition: SemaDecl.cpp:9974
void PopParsingClass(ParsingClassState state)
Definition: Sema.h:5014
bool CheckOverridingFunctionAttributes(const CXXMethodDecl *New, const CXXMethodDecl *Old)
bool DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, CorrectionCandidateCallback &CCC, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, ArrayRef< Expr * > Args=std::nullopt, DeclContext *LookupCtx=nullptr, TypoExpr **Out=nullptr)
Diagnose an empty lookup.
Definition: SemaExpr.cpp:2544
void CodeCompleteTag(Scope *S, unsigned TagSpec)
OpenCLOptions & getOpenCLOptions()
Definition: Sema.h:522
void DiagnoseAbstractType(const CXXRecordDecl *RD)
void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow)
Hides a using shadow declaration.
bool CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename, const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, SourceLocation NameLoc, const LookupResult *R=nullptr, const UsingDecl *UD=nullptr)
Checks that the given nested-name qualifier used in a using decl in the current context is appropriat...
void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, const ObjCMethodDecl *Overridden)
Check whether the given new method is a valid override of the given overridden method,...
bool IsBuildingRecoveryCallExpr
Flag indicating if Sema is building a recovery call expression.
Definition: Sema.h:8090
void LoadExternalWeakUndeclaredIdentifiers()
Load weak undeclared identifiers from the external source.
Definition: Sema.cpp:966
bool containsUnexpandedParameterPacks(Declarator &D)
Determine whether the given declarator contains any unexpanded parameter packs.
bool CheckExplicitObjectOverride(CXXMethodDecl *New, const CXXMethodDecl *Old)
QualType FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
FindCompositeObjCPointerType - Helper method to find composite type of two objective-c pointer types ...
Definition: SemaExpr.cpp:8906
llvm::SmallPtrSet< SpecialMemberDecl, 4 > SpecialMembersBeingDeclared
The C++ special members which we are currently in the process of declaring.
Definition: Sema.h:5003
void ActOnParamUnparsedDefaultArgument(Decl *param, SourceLocation EqualLoc, SourceLocation ArgLoc)
ActOnParamUnparsedDefaultArgument - We've seen a default argument for a function parameter,...
void CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr)
QualType CheckVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
DefaultedFunctionKind getDefaultedFunctionKind(const FunctionDecl *FD)
Determine the kind of defaulting that would be done for a given function.
bool CheckARCMethodDecl(ObjCMethodDecl *method)
Check a method declaration for compatibility with the Objective-C ARC conventions.
bool checkArrayElementAlignment(QualType EltTy, SourceLocation Loc)
Definition: SemaType.cpp:2485
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
void ProcessStmtAttributes(Stmt *Stmt, const ParsedAttributes &InAttrs, SmallVectorImpl< const Attr * > &OutAttrs)
Process the attributes before creating an attributed statement.
ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Op, Expr *Input, bool IsAfterAmp=false)
Definition: SemaExpr.cpp:16143
bool RequireCompleteSizedExprType(Expr *E, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:6541
bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S=nullptr, bool AllowInlineNamespace=false) const
isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true if 'D' is in Scope 'S',...
Definition: SemaDecl.cpp:1584
bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool UseMemberUsingDeclRules, bool ConsiderCudaAttrs=true)
ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val)
Definition: SemaExpr.cpp:3916
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr, bool IsAfterAmp=false)
Definition: SemaExpr.cpp:15819
void ActOnStartOfObjCMethodDef(Scope *S, Decl *D)
ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible and user declared,...
llvm::DenseSet< Module * > & getLookupModules()
Get the set of additional modules that should be checked during name lookup.
bool isValidRVVBitcast(QualType srcType, QualType destType)
Are the two types RVV-bitcast-compatible types? I.e.
Definition: SemaExpr.cpp:7812
SYCLIntelMaxConcurrencyAttr * MergeSYCLIntelMaxConcurrencyAttr(Decl *D, const SYCLIntelMaxConcurrencyAttr &A)
void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath)
bool isAlwaysConstantEvaluatedContext() const
Definition: Sema.h:6448
bool isExternalWithNoLinkageType(const ValueDecl *VD) const
Determine if VD, which must be a variable or function, is an external symbol that nonetheless can't b...
Definition: Sema.cpp:840
void DiagnoseUnusedParameters(ArrayRef< ParmVarDecl * > Parameters)
Diagnose any unused parameters in the given sequence of ParmVarDecl pointers.
Definition: SemaDecl.cpp:15394
DeclGroupPtrTy ActOnFinishObjCImplementation(Decl *ObjCImpDecl, ArrayRef< Decl * > Decls)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
Definition: SemaStmt.cpp:4763
bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, SourceRange PatternRange, ArrayRef< UnexpandedParameterPack > Unexpanded, const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand, bool &RetainExpansion, std::optional< unsigned > &NumExpansions)
Determine whether we could expand a pack expansion with the given set of parameter packs into separat...
void ActOnPragmaAttributeEmptyPush(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
Definition: SemaAttr.cpp:1067
ExprResult IgnoredValueConversions(Expr *E)
IgnoredValueConversions - Given that an expression's result is syntactically ignored,...
void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old)
Merge the exception specifications of two variable declarations.
NamedDecl * FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS)
If the given nested-name-specifier begins with a bare identifier (e.g., Base::), perform name lookup ...
bool RequireCompleteSizedType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:6534
bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy, UnresolvedSetImpl &NonTemplateOverloads)
Figure out if an expression could be turned into a call.
Definition: Sema.cpp:2553
CXXSpecialMemberKind getSpecialMember(const CXXMethodDecl *MD)
Definition: Sema.h:4807
LookupNameKind
Describes the kind of name lookup to perform.
Definition: Sema.h:7541
@ LookupLabel
Label name lookup.
Definition: Sema.h:7550
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
Definition: Sema.h:7545
@ LookupUsingDeclName
Look up all declarations in a scope with the given name, including resolved using declarations.
Definition: Sema.h:7572
@ LookupNestedNameSpecifierName
Look up of a name that precedes the '::' scope resolution operator in C++.
Definition: Sema.h:7564
@ LookupOMPReductionName
Look up the name of an OpenMP user-defined reduction operation.
Definition: Sema.h:7586
@ LookupLocalFriendName
Look up a friend of a local class.
Definition: Sema.h:7580
@ LookupObjCProtocolName
Look up the name of an Objective-C protocol.
Definition: Sema.h:7582
@ LookupRedeclarationWithLinkage
Look up an ordinary name that is going to be redeclared as a name with linkage.
Definition: Sema.h:7577
@ LookupOperatorName
Look up of an operator name (e.g., operator+) for use with operator overloading.
Definition: Sema.h:7557
@ LookupObjCImplicitSelfParam
Look up implicit 'self' parameter of an objective-c method.
Definition: Sema.h:7584
@ LookupNamespaceName
Look up a namespace name within a C++ using directive or namespace alias definition,...
Definition: Sema.h:7568
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
Definition: Sema.h:7553
@ LookupDestructorName
Look up a name following ~ in a destructor name.
Definition: Sema.h:7560
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
Definition: Sema.h:7548
@ LookupOMPMapperName
Look up the name of an OpenMP user-defined mapper.
Definition: Sema.h:7588
@ LookupAnyName
Look up any declaration with any name.
Definition: Sema.h:7590
void DiagnoseSentinelCalls(const NamedDecl *D, SourceLocation Loc, ArrayRef< Expr * > Args)
DiagnoseSentinelCalls - This routine checks whether a call or message-send is to a declaration with t...
Definition: SemaExpr.cpp:491
llvm::DenseMap< IdentifierInfo *, SrcLocSet > IdentifierSourceLocations
Definition: Sema.h:7485
void CodeCompleteUsing(Scope *S)
LazyVector< TypedefNameDecl *, ExternalSemaSource, &ExternalSemaSource::ReadExtVectorDecls, 2, 2 > ExtVectorDeclsType
Definition: Sema.h:3598
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
void DiagnoseFunctionSpecifiers(const DeclSpec &DS)
Diagnose function specifiers on a declaration of an identifier that does not identify a function.
Definition: SemaDecl.cpp:6822
QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace, SourceLocation AttrLoc)
BuildAddressSpaceAttr - Builds a DependentAddressSpaceType if an expression is uninstantiated.
Definition: SemaType.cpp:6929
void ActOnPragmaAttributePop(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
Called on well-formed '#pragma clang attribute pop'.
Definition: SemaAttr.cpp:1074
ExprResult ParseObjCProtocolExpression(IdentifierInfo *ProtocolName, SourceLocation AtLoc, SourceLocation ProtoLoc, SourceLocation LParenLoc, SourceLocation ProtoIdLoc, SourceLocation RParenLoc)
ParseObjCProtocolExpression - Build protocol expression for @protocol.
void ActOnPopScope(SourceLocation Loc, Scope *S)
Definition: SemaDecl.cpp:2236
void ActOnDefinedDeclarationSpecifier(Decl *D)
Called once it is known whether a tag declaration is an anonymous union or struct.
Definition: SemaDecl.cpp:5461
QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement)
Completely replace the auto in TypeWithAuto by Replacement.
ExprResult ActOnConstantExpression(ExprResult Res)
Definition: SemaExpr.cpp:19956
void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name, StringRef Value)
ActOnPragmaDetectMismatch - Call on well-formed #pragma detect_mismatch.
Definition: SemaAttr.cpp:526
QualType CheckLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
Definition: SemaExpr.cpp:13558
ExprResult ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation LParen, Expr *Operand, SourceLocation RParen)
Decl * ActOnSkippedFunctionBody(Decl *Decl)
Definition: SemaDecl.cpp:16115
bool checkObjCBridgeRelatedComponents(SourceLocation Loc, QualType DestType, QualType SrcType, ObjCInterfaceDecl *&RelatedClass, ObjCMethodDecl *&ClassMethod, ObjCMethodDecl *&InstanceMethod, TypedefNameDecl *&TDNDecl, bool CfToNs, bool Diagnose=true)
bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:4769
SYCLIntelMaxReplicatesAttr * MergeSYCLIntelMaxReplicatesAttr(Decl *D, const SYCLIntelMaxReplicatesAttr &A)
VariadicCallType
Definition: Sema.h:2014
@ VariadicDoesNotApply
Definition: Sema.h:2019
@ VariadicFunction
Definition: Sema.h:2015
@ VariadicMethod
Definition: Sema.h:2017
@ VariadicConstructor
Definition: Sema.h:2018
@ VariadicBlock
Definition: Sema.h:2016
QualType deduceVarTypeFromInitializer(VarDecl *VDecl, DeclarationName Name, QualType Type, TypeSourceInfo *TSI, SourceRange Range, bool DirectInit, Expr *Init)
Definition: SemaDecl.cpp:13143
Decl * BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *AssertMessageExpr, SourceLocation RParenLoc, bool Failed)
void EvaluateImplicitExceptionSpec(SourceLocation Loc, FunctionDecl *FD)
Evaluate the implicit exception specification for a defaulted special member function.
ExprResult ActOnClassPropertyRefExpr(const IdentifierInfo &receiverName, const IdentifierInfo &propertyName, SourceLocation receiverNameLoc, SourceLocation propertyNameLoc)
void ActOnAnnotModuleBegin(SourceLocation DirectiveLoc, Module *Mod)
The parsed has entered a submodule.
Definition: SemaModule.cpp:759
TemplateName SubstTemplateName(NestedNameSpecifierLoc QualifierLoc, TemplateName Name, SourceLocation Loc, const MultiLevelTemplateArgumentList &TemplateArgs)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, Expr *OtherOpBase, SourceLocation OpLoc, bool IsArrow, bool IsBaseExprStatement, QualType PreferredType)
ParmVarDecl * SubstParmVarDecl(ParmVarDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, int indexAdjustment, std::optional< unsigned > NumExpansions, bool ExpectParameterPack, bool EvaluateConstraints=true)
ExplicitSpecifier ActOnExplicitBoolSpecifier(Expr *E)
ActOnExplicitBoolSpecifier - Build an ExplicitSpecifier from an expression found in an explicit(bool)...
ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc, Expr *InitExpr)
Definition: SemaExpr.cpp:7296
void AddSYCLIntelMaxConcurrencyAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
AddSYCLIntelMaxConcurrencyAttr - Adds a max_concurrency attribute to a particular declaration.
ArrayRef< sema::FunctionScopeInfo * > getFunctionScopes() const
Definition: Sema.h:9010
VarDecl * createLambdaInitCaptureVarDecl(SourceLocation Loc, QualType InitCaptureType, SourceLocation EllipsisLoc, IdentifierInfo *Id, unsigned InitStyle, Expr *Init, DeclContext *DeclCtx)
Create a dummy variable within the declcontext of the lambda's call operator, for name lookup purpose...
Definition: SemaLambda.cpp:809
bool DiagRedefinedPlaceholderFieldDecl(SourceLocation Loc, RecordDecl *ClassDecl, const IdentifierInfo *Name)
void ActOnFinishCXXNonNestedClass()
ExprResult ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body)
ActOnLambdaExpr - This is called when the body of a lambda expression was successfully completed.
bool CheckObjCBridgeRelatedConversions(SourceLocation Loc, QualType DestType, QualType SrcType, Expr *&SrcExpr, bool Diagnose=true)
DelayedDiagnosticsState ParsingDeclState
Definition: Sema.h:933
bool SetMemberAccessSpecifier(NamedDecl *MemberDecl, NamedDecl *PrevMemberDecl, AccessSpecifier LexicalAS)
SetMemberAccessSpecifier - Set the access specifier of a member.
Definition: SemaAccess.cpp:40
NamedDecl * FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, bool FindingInstantiatedContext=false)
Find the instantiation of the given declaration within the current instantiation.
bool BuildTypeConstraint(const CXXScopeSpec &SS, TemplateIdAnnotation *TypeConstraint, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc, bool AllowUnexpandedPack)
NonTrivialCUnionContext
Definition: Sema.h:3006
@ NTCUC_CopyInit
Definition: Sema.h:3016
@ NTCUC_AutoVar
Definition: Sema.h:3014
@ NTCUC_CompoundLiteral
Definition: Sema.h:3020
@ NTCUC_DefaultInitializedObject
Definition: Sema.h:3012
@ NTCUC_Assignment
Definition: Sema.h:3018
@ NTCUC_BlockCapture
Definition: Sema.h:3022
@ NTCUC_FunctionReturn
Definition: Sema.h:3010
@ NTCUC_LValueToRValueVolatile
Definition: Sema.h:3024
@ NTCUC_FunctionParam
Definition: Sema.h:3008
MemInitResult BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, Expr *Init, CXXRecordDecl *ClassDecl, SourceLocation EllipsisLoc)
const Decl * PragmaAttributeCurrentTargetDecl
The declaration that is currently receiving an attribute from the #pragma attribute stack.
Definition: Sema.h:1482
ImplicitConversionSequence TryImplicitConversion(Expr *From, QualType ToType, bool SuppressUserConversions, AllowedExplicit AllowExplicit, bool InOverloadResolution, bool CStyle, bool AllowObjCWritebackConversion)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
ExprResult BuildLiteralOperatorCall(LookupResult &R, DeclarationNameInfo &SuffixInfo, ArrayRef< Expr * > Args, SourceLocation LitEndLoc, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr)
BuildLiteralOperatorCall - Build a UserDefinedLiteral by creating a call to a literal operator descri...
bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S, bool MergeTypeWithOld, bool NewDeclIsDefn)
MergeFunctionDecl - We just parsed a function 'New' from declarator D which has the same name and sco...
Definition: SemaDecl.cpp:3722
void CodeCompleteCase(Scope *S)
void RegisterTypeTagForDatatype(const IdentifierInfo *ArgumentKind, uint64_t MagicValue, QualType Type, bool LayoutCompatible, bool MustBeNull)
Register a magic integral constant to be used as a type tag.
bool hasReachableDeclarationSlow(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
MissingImportKind
Kinds of missing import.
Definition: Sema.h:7795
void ProcessDeclAttributeDelayed(Decl *D, const ParsedAttributesView &AttrList)
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
void ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class)
Force the declaration of any implicitly-declared members of this class.
bool isTemplateTemplateParameterAtLeastAsSpecializedAs(TemplateParameterList *PParam, TemplateDecl *AArg, SourceLocation Loc)
void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc, Expr *DefaultArg)
ActOnParamDefaultArgumentError - Parsing or semantic analysis of the default argument for the paramet...
bool areVectorTypesSameSize(QualType srcType, QualType destType)
Definition: SemaExpr.cpp:7840
bool diagnoseQualifiedDeclaration(CXXScopeSpec &SS, DeclContext *DC, DeclarationName Name, SourceLocation Loc, TemplateIdAnnotation *TemplateId, bool IsMemberSpecialization)
Diagnose a declaration whose declarator-id has the given nested-name-specifier.
Definition: SemaDecl.cpp:6291
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
Definition: SemaStmt.cpp:4384
AvailabilityAttr * mergeAvailabilityAttr(NamedDecl *D, const AttributeCommonInfo &CI, IdentifierInfo *Platform, bool Implicit, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted, bool IsUnavailable, StringRef Message, bool IsStrict, StringRef Replacement, AvailabilityMergeKind AMK, int Priority)
bool hasVisibleDeclarationSlow(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules)
TemplateParameterList * ActOnTemplateParameterList(unsigned Depth, SourceLocation ExportLoc, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
ActOnTemplateParameterList - Builds a TemplateParameterList, optionally constrained by RequiresClause...
void LookupNecessaryTypesForBuiltin(Scope *S, unsigned ID)
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
void DiagnoseStaticAssertDetails(const Expr *E)
Try to print more useful information about a failed static_assert with expression \E.
void ActOnAnnotModuleInclude(SourceLocation DirectiveLoc, Module *Mod)
The parser has processed a module import translated from a #include or similar preprocessing directiv...
Definition: SemaModule.cpp:720
ExprResult BuildIvarRefExpr(Scope *S, SourceLocation Loc, ObjCIvarDecl *IV)
Definition: SemaExpr.cpp:3178
RetainOwnershipKind
Definition: Sema.h:3722
OpaquePtr< QualType > TypeTy
Definition: Sema.h:852
void CodeCompleteObjCMessageReceiver(Scope *S)
void ActOnTagDefinitionError(Scope *S, Decl *TagDecl)
ActOnTagDefinitionError - Invoked when there was an unrecoverable error parsing the definition of a t...
Definition: SemaDecl.cpp:18572
void AddSYCLIntelMaxReplicatesAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
void DiagnoseAlwaysNonNullPointer(Expr *E, Expr::NullPointerConstantKind NullType, bool IsEqual, SourceRange Range)
Diagnose pointers that are always non-null.
bool IsStringInit(Expr *Init, const ArrayType *AT)
Definition: SemaInit.cpp:167
ObjCMethodDecl * ArrayWithObjectsMethod
The declaration of the arrayWithObjects:count: method.
Definition: Sema.h:12413
DeclGroupPtrTy ActOnForwardClassDeclaration(SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs, ArrayRef< ObjCTypeParamList * > TypeParamLists, unsigned NumElts)
void DefineImplicitMoveAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared move assignment operator.
void ActOnFinishDelayedMemberInitializers(Decl *Record)
ObjCMethodDecl * StringWithUTF8StringMethod
The declaration of the stringWithUTF8String: method.
Definition: Sema.h:12404
bool CheckCXXThisType(SourceLocation Loc, QualType Type)
Check whether the type of 'this' is valid in the current context.
void CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body)
bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class)
Perform qualified name lookup into all base classes of the given class.
void addImplicitTypedef(StringRef Name, QualType T)
Definition: Sema.cpp:270
void PrintContextStack()
Definition: Sema.h:10518
TypeResult ActOnTemplateIdType(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, const IdentifierInfo *TemplateII, SourceLocation TemplateIILoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false, bool IsClassName=false, ImplicitTypenameContext AllowImplicitTypename=ImplicitTypenameContext::No)
void DecomposeUnqualifiedId(const UnqualifiedId &Id, TemplateArgumentListInfo &Buffer, DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *&TemplateArgs)
Decomposes the given name into a DeclarationNameInfo, its location, and possibly a list of template a...
Definition: SemaExpr.cpp:2419
void CheckConflictingOverridingMethod(ObjCMethodDecl *Method, ObjCMethodDecl *Overridden, bool IsProtocolMethodDecl)
bool ActOnCoroutineBodyStart(Scope *S, SourceLocation KwLoc, StringRef Keyword)
ObjCMethodDecl * LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupInstanceMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
Definition: Sema.h:12643
Decl * ActOnConceptDefinition(Scope *S, MultiTemplateParamsArg TemplateParameterLists, const IdentifierInfo *Name, SourceLocation NameLoc, Expr *ConstraintExpr)
QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc)
Definition: SemaType.cpp:2786
bool InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
void AddModeAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Name, bool InInstantiation=false)
AddModeAttr - Adds a mode attribute to a particular declaration.
StmtResult BuildAttributedStmt(SourceLocation AttrsLoc, ArrayRef< const Attr * > Attrs, Stmt *SubStmt)
Definition: SemaStmt.cpp:607
NamedDecl * ActOnTemplateTemplateParameter(Scope *S, SourceLocation TmpLoc, TemplateParameterList *Params, bool Typename, SourceLocation EllipsisLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedTemplateArgument DefaultArg)
ActOnTemplateTemplateParameter - Called when a C++ template template parameter (e....
IfExistsResult
Describes the result of an "if-exists" condition check.
Definition: Sema.h:7041
@ IER_DoesNotExist
The symbol does not exist.
Definition: Sema.h:7046
@ IER_Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
Definition: Sema.h:7050
@ IER_Error
An error occurred.
Definition: Sema.h:7053
@ IER_Exists
The symbol exists.
Definition: Sema.h:7043
void CheckDelegatingCtorCycles()
llvm::SmallSet< SourceLocation, 2 > SrcLocSet
Definition: Sema.h:7484
SYCLIntelNumSimdWorkItemsAttr * MergeSYCLIntelNumSimdWorkItemsAttr(Decl *D, const SYCLIntelNumSimdWorkItemsAttr &A)
void ActOnStartStmtExpr()
Definition: SemaExpr.cpp:16163
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, sema::LambdaScopeInfo *LSI)
Complete a lambda-expression having processed and attached the lambda body.
bool CheckCallingConvAttr(const ParsedAttr &attr, CallingConv &CC, const FunctionDecl *FD=nullptr, CUDAFunctionTarget CFT=CUDAFunctionTarget::InvalidTarget)
Check validaty of calling convention attribute attr.
bool ActOnTypeConstraint(const CXXScopeSpec &SS, TemplateIdAnnotation *TypeConstraint, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
ExprResult CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, SourceLocation RLoc, Expr *Base, MultiExprArg Args)
SmallVector< CXXMethodDecl *, 4 > DelayedDllExportMemberFunctions
Definition: Sema.h:4798
bool hasVisibleDeclaration(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine whether any declaration of an entity is visible.
Definition: Sema.h:7721
bool FormatStringHasSArg(const StringLiteral *FExpr)
void WarnOnPendingNoDerefs(ExpressionEvaluationContextRecord &Rec)
Emit a warning for all pending noderef expressions that we recorded.
Definition: SemaExpr.cpp:17805
QualType ProduceCallSignatureHelp(Expr *Fn, ArrayRef< Expr * > Args, SourceLocation OpenParLoc)
Determines the preferred type of the current function argument, by examining the signatures of all po...
void ProcessPragmaWeak(Scope *S, Decl *D)
void ActOnStmtExprError()
Definition: SemaExpr.cpp:16169
bool IsLastErrorImmediate
Is the last error level diagnostic immediate.
Definition: Sema.h:925
StmtResult ActOnSEHLeaveStmt(SourceLocation Loc, Scope *CurScope)
Definition: SemaStmt.cpp:4752
DeclResult LookupIvarInObjCMethod(LookupResult &Lookup, Scope *S, IdentifierInfo *II)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
Definition: SemaExpr.cpp:3105
void CodeCompleteInitializer(Scope *S, Decl *D)
void ActOnPragmaFEnvRound(SourceLocation Loc, llvm::RoundingMode)
Called to set constant rounding mode for floating point operations.
Definition: SemaAttr.cpp:1336
bool checkStringLiteralArgumentAttr(const ParsedAttr &Attr, unsigned ArgNum, StringRef &Str, SourceLocation *ArgLocation=nullptr)
ObjCInterfaceDecl * NSDictionaryDecl
The declaration of the Objective-C NSDictionary class.
Definition: Sema.h:12416
void CheckExplicitObjectMemberFunction(Declarator &D, DeclarationName Name, QualType R, bool IsLambda, DeclContext *DC=nullptr)
bool DiagnoseClassNameShadow(DeclContext *DC, DeclarationNameInfo Info)
DiagnoseClassNameShadow - Implement C++ [class.mem]p13: If T is the name of a class,...
Definition: SemaDecl.cpp:6258
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
Definition: SemaStmt.cpp:2314
AccessResult CheckFriendAccess(NamedDecl *D)
Checks access to the target of a friend declaration.
QualType UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, ArithConvKind ACK)
UsualArithmeticConversions - Performs various conversions that are common to binary operators (C99 6....
Definition: SemaExpr.cpp:1629
bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType, MultiExprArg Args, Selector Sel, ArrayRef< SourceLocation > SelectorLocs, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage, SourceLocation lbrac, SourceLocation rbrac, SourceRange RecRange, QualType &ReturnType, ExprValueKind &VK)
CheckMessageArgumentTypes - Check types in an Obj-C message send.
QualType ProduceConstructorSignatureHelp(QualType Type, SourceLocation Loc, ArrayRef< Expr * > Args, SourceLocation OpenParLoc, bool Braced)
StmtResult ActOnForEachLValueExpr(Expr *E)
In an Objective C collection iteration statement: for (x in y) x can be an arbitrary l-value expressi...
Definition: SemaStmt.cpp:2227
void MarkBaseAndMemberDestructorsReferenced(SourceLocation Loc, CXXRecordDecl *Record)
MarkBaseAndMemberDestructorsReferenced - Given a record decl, mark all the non-trivial destructors of...
const TranslationUnitKind TUKind
The kind of translation unit we are processing.
Definition: Sema.h:826
void ActOnTagFinishDefinition(Scope *S, Decl *TagDecl, SourceRange BraceRange)
ActOnTagFinishDefinition - Invoked once we have finished parsing the definition of a tag (enumeration...
Definition: SemaDecl.cpp:18497
FunctionEmissionStatus
Status of the function emission on the CUDA/HIP/OpenMP host/device attrs.
Definition: Sema.h:3513
llvm::SmallSetVector< const TypedefNameDecl *, 4 > UnusedLocalTypedefNameCandidates
Set containing all typedefs that are likely unused.
Definition: Sema.h:2626
PragmaClangSection PragmaClangRodataSection
Definition: Sema.h:1189
DeclResult ActOnCXXConditionDeclaration(Scope *S, Declarator &D)
ActOnCXXConditionDeclarationExpr - Parsed a condition declaration of a C++ if/switch/while/for statem...
void CheckPtrComparisonWithNullChar(ExprResult &E, ExprResult &NullE)
Definition: SemaExpr.cpp:12569
void LookupOverloadedBinOp(OverloadCandidateSet &CandidateSet, OverloadedOperatorKind Op, const UnresolvedSetImpl &Fns, ArrayRef< Expr * > Args, bool RequiresADL=true)
Perform lookup for an overloaded binary operator.
void NoteAllFoundTemplates(TemplateName Name)
CXXRecordDecl * createLambdaClosureType(SourceRange IntroducerRange, TypeSourceInfo *Info, unsigned LambdaDependencyKind, LambdaCaptureDefault CaptureDefault)
Create a new lambda closure type.
Definition: SemaLambda.cpp:247
bool hasVisibleDefinition(const NamedDecl *D)
Definition: Sema.h:11950
ObjCContainerKind
Definition: Sema.h:12053
@ OCK_Interface
Definition: Sema.h:12055
@ OCK_ClassExtension
Definition: Sema.h:12058
@ OCK_Category
Definition: Sema.h:12057
@ OCK_Implementation
Definition: Sema.h:12059
@ OCK_CategoryImplementation
Definition: Sema.h:12060
@ OCK_None
Definition: Sema.h:12054
@ OCK_Protocol
Definition: Sema.h:12056
DelegatingCtorDeclsType DelegatingCtorDecls
All the delegating constructors seen so far in the file, used for cycle detection at the end of the T...
Definition: Sema.h:4980
void emitAndClearUnusedLocalTypedefWarnings()
Definition: Sema.cpp:1057
bool ActOnAccessSpecifier(AccessSpecifier Access, SourceLocation ASLoc, SourceLocation ColonLoc, const ParsedAttributesView &Attrs)
ActOnAccessSpecifier - Parsed an access specifier followed by a colon.
NamedDecl * ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II, Scope *S)
ImplicitlyDefineFunction - An undeclared identifier was used in a function call, forming a call to an...
Definition: SemaDecl.cpp:16656
bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation, NamedDecl *Instantiation, bool InstantiatedFromMember, const NamedDecl *Pattern, const NamedDecl *PatternDef, TemplateSpecializationKind TSK, bool Complain=true)
Determine whether we would be unable to instantiate this template (because it either has no definitio...
std::unique_ptr< CXXFieldCollector > FieldCollector
FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
Definition: Sema.h:4961
static bool getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember, bool IsVariadic, FormatStringInfo *FSI)
Given a FunctionDecl's FormatAttr, attempts to populate the FomatStringInfo parameter with the Format...
void ActOnForEachDeclStmt(DeclGroupPtrTy Decl)
Definition: SemaStmt.cpp:89
Decl * ActOnParamDeclarator(Scope *S, Declarator &D, SourceLocation ExplicitThisLoc={})
ActOnParamDeclarator - Called from Parser::ParseFunctionDeclarator() to introduce parameters into fun...
Definition: SemaDecl.cpp:15271
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
std::unique_ptr< NSAPI > NSAPIObj
Caches identifiers/selectors for NSFoundation APIs.
Definition: Sema.h:12380
TypeResult ActOnDependentTag(Scope *S, unsigned TagSpec, TagUseKind TUK, const CXXScopeSpec &SS, const IdentifierInfo *Name, SourceLocation TagLoc, SourceLocation NameLoc)
bool checkSectionName(SourceLocation LiteralLoc, StringRef Str)
VarDecl * buildCoroutinePromise(SourceLocation Loc)
QualType BuildObjCObjectType(QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc, ArrayRef< TypeSourceInfo * > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError, bool Rebuilding)
Build an Objective-C object pointer type.
Definition: SemaType.cpp:1094
unsigned CapturingFunctionScopes
Track the number of currently active capturing scopes.
Definition: Sema.h:815
void AddPragmaAttributes(Scope *S, Decl *D)
Adds the attributes that have been specified using the '#pragma clang attribute push' directives to t...
Definition: SemaAttr.cpp:1109
ExprResult ActOnExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
ActOnExpressionTrait - Parsed one of the unary type trait support pseudo-functions.
TemplateDecl * AdjustDeclIfTemplate(Decl *&Decl)
AdjustDeclIfTemplate - If the given decl happens to be a template, reset the parameter D to reference...
bool isImplicitlyDeleted(FunctionDecl *FD)
Determine whether the given function is an implicitly-deleted special member function.
void CheckImplicitSpecialMemberDeclaration(Scope *S, FunctionDecl *FD)
Check a completed declaration of an implicit special member.
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, ExpressionEvaluationContextRecord::ExpressionKind Type=ExpressionEvaluationContextRecord::EK_Other)
Definition: SemaExpr.cpp:17739
bool checkCommonAttributeFeatures(const Decl *D, const ParsedAttr &A, bool SkipArgCountCheck=false)
Handles semantic checking for features that are common to all attributes, such as checking whether a ...
Definition: SemaAttr.cpp:1470
PragmaClangSectionAction
Definition: Sema.h:1179
@ PCSA_Set
Definition: Sema.h:1179
@ PCSA_Clear
Definition: Sema.h:1179
void CodeCompleteObjCAtDirective(Scope *S)
bool CompleteConstructorCall(CXXConstructorDecl *Constructor, QualType DeclInitType, MultiExprArg ArgsPtr, SourceLocation Loc, SmallVectorImpl< Expr * > &ConvertedArgs, bool AllowExplicit=false, bool IsListInitialization=false)
Given a constructor and the set of arguments provided for the constructor, convert the arguments and ...
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
Definition: SemaExpr.cpp:20705
void InstantiateClassTemplateSpecializationMembers(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK)
Instantiate the definitions of all of the members of the given class template specialization,...
MinSizeAttr * mergeMinSizeAttr(Decl *D, const AttributeCommonInfo &CI)
void Initialize()
Perform initialization that occurs after the parser has been initialized but before it parses anythin...
Definition: Sema.cpp:276
ConditionKind
Definition: Sema.h:6067
@ Switch
An integral condition for a 'switch' statement.
void LateTemplateParserCB(void *P, LateParsedTemplate &LPT)
Callback to the parser to parse templated functions when needed.
Definition: Sema.h:902
void AddOptnoneAttributeIfNoConflicts(FunctionDecl *FD, SourceLocation Loc)
Adds the 'optnone' attribute to the function declaration if there are no conflicts; Loc represents th...
Definition: SemaAttr.cpp:1207
ExprResult ActOnObjCBridgedCast(Scope *S, SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, ParsedType Type, SourceLocation RParenLoc, Expr *SubExpr)
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Definition: Sema.h:11909
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
static SourceRange getPrintable(SourceLocation L)
Definition: Sema.h:11640
void AddConversionCandidate(CXXConversionDecl *Conversion, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, Expr *From, QualType ToType, OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit, bool AllowExplicit, bool AllowResultConversion=true)
AddConversionCandidate - Add a C++ conversion function as a candidate in the candidate set (C++ [over...
ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand, CorrectionCandidateCallback *CCC=nullptr, bool IsInlineAsmIdentifier=false, Token *KeywordReplacement=nullptr)
Definition: SemaExpr.cpp:2760
bool TemplateParameterListsAreEqual(const TemplateCompareNewDeclInfo &NewInstFrom, TemplateParameterList *New, const NamedDecl *OldInstFrom, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Determine whether the given template parameter lists are equivalent.
ObjCTypeParamList * actOnObjCTypeParamList(Scope *S, SourceLocation lAngleLoc, ArrayRef< Decl * > typeParams, SourceLocation rAngleLoc)
Decl * ActOnNamespaceAliasDef(Scope *CurScope, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *Ident)
void CheckOverrideControl(NamedDecl *D)
CheckOverrideControl - Check C++11 override control semantics.
ModuleDeclKind
Definition: Sema.h:7925
void CheckCategoryVsClassMethodMatches(ObjCCategoryImplDecl *CatIMP)
CheckCategoryVsClassMethodMatches - Checks that methods implemented in category matches with those im...
TemplateArgumentLoc SubstDefaultTemplateArgumentIfAvailable(TemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, Decl *Param, ArrayRef< TemplateArgument > SugaredConverted, ArrayRef< TemplateArgument > CanonicalConverted, bool &HasDefaultArg)
If the given template parameter has a default template argument, substitute into that default templat...
SmallVector< sema::FunctionScopeInfo *, 4 > FunctionScopes
Stack containing information about each of the nested function, block, and method scopes that are cur...
Definition: Sema.h:808
bool ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMemberKind CSM, InheritedConstructorInfo *ICI=nullptr, bool Diagnose=false)
Determine if a special member function should have a deleted definition when it is defaulted.
void ActOnExitFunctionContext()
Definition: SemaDecl.cpp:1479
void AddSYCLIntelMaxWorkGroupsPerMultiprocessorAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
bool CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType)
bool ActOnDuplicateODRHashDefinition(T *Duplicate, T *Previous)
Check ODR hashes for C/ObjC when merging types from modules.
Definition: Sema.h:12040
void ActOnTypedefedProtocols(SmallVectorImpl< Decl * > &ProtocolRefs, SmallVectorImpl< SourceLocation > &ProtocolLocs, IdentifierInfo *SuperName, SourceLocation SuperLoc)
ActOnTypedefedProtocols - this action finds protocol list as part of the typedef'ed use for a qualifi...
ReferenceCompareResult
ReferenceCompareResult - Expresses the result of comparing two types (cv1 T1 and cv2 T2) to determine...
Definition: Sema.h:8308
@ Ref_Incompatible
Ref_Incompatible - The two types are incompatible, so direct reference binding is not possible.
Definition: Sema.h:8311
@ Ref_Compatible
Ref_Compatible - The two types are reference-compatible.
Definition: Sema.h:8317
@ Ref_Related
Ref_Related - The two types are reference-related, which means that their unqualified forms (T1 and T...
Definition: Sema.h:8315
void CodeCompleteObjCClassPropertyRefExpr(Scope *S, const IdentifierInfo &ClassName, SourceLocation ClassNameLoc, bool IsBaseExprStatement)
void RefersToMemberWithReducedAlignment(Expr *E, llvm::function_ref< void(Expr *, RecordDecl *, FieldDecl *, CharUnits)> Action)
This function calls Action when it determines that E designates a misaligned member due to the packed...
bool isMemberAccessibleForDeletion(CXXRecordDecl *NamingClass, DeclAccessPair Found, QualType ObjectType)
Definition: Sema.h:1135
ExprResult RebuildExprInCurrentInstantiation(Expr *E)
DeclResult ActOnVarTemplateSpecialization(Scope *S, Declarator &D, TypeSourceInfo *DI, LookupResult &Previous, SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams, StorageClass SC, bool IsPartialSpecialization)
AccessResult
Definition: Sema.h:1073
@ AR_dependent
Definition: Sema.h:1076
@ AR_accessible
Definition: Sema.h:1074
@ AR_inaccessible
Definition: Sema.h:1075
@ AR_delayed
Definition: Sema.h:1077
PoppedFunctionScopePtr PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP=nullptr, const Decl *D=nullptr, QualType BlockType=QualType())
Pop a function (or block or lambda or captured region) scope from the stack.
Definition: Sema.cpp:2345
ClassTemplatePartialSpecializationDecl * getMoreSpecializedPartialSpecialization(ClassTemplatePartialSpecializationDecl *PS1, ClassTemplatePartialSpecializationDecl *PS2, SourceLocation Loc)
Returns the more specialized class template partial specialization according to the rules of partial ...
CompleteTypeKind
Definition: Sema.h:11644
@ Normal
Apply the normal rules for complete types.
bool checkAndRewriteMustTailAttr(Stmt *St, const Attr &MTA)
Check whether the given statement can have musttail applied to it, issuing a diagnostic and returning...
Definition: SemaStmt.cpp:636
ExprResult BuildCXXFunctionalCastExpr(TypeSourceInfo *TInfo, QualType Type, SourceLocation LParenLoc, Expr *CastExpr, SourceLocation RParenLoc)
Definition: SemaCast.cpp:3385
void AddTemplateConversionCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, Expr *From, QualType ToType, OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit, bool AllowExplicit, bool AllowResultConversion=true)
Adds a conversion function template specialization candidate to the overload set, using template argu...
Scope * getScopeForContext(DeclContext *Ctx)
Determines the active Scope associated with the given declaration context.
Definition: Sema.cpp:2207
QualType GetSignedSizelessVectorType(QualType V)
Definition: SemaExpr.cpp:13132
llvm::DenseSet< std::pair< Decl *, unsigned > > InstantiatingSpecializations
Specializations whose definitions are currently being instantiated.
Definition: Sema.h:10435
bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit=false, bool BuildAndDiagnose=true, const unsigned *const FunctionScopeIndexToStopAt=nullptr, bool ByCopy=false)
Make sure the value of 'this' is actually available in the current context, if it is a potentially ev...
void ActOnLambdaExpressionAfterIntroducer(LambdaIntroducer &Intro, Scope *CurContext)
Once the Lambdas capture are known, we can start to create the closure, call operator method,...
FunctionTemplateDecl * DeclareAggregateDeductionGuideFromInitList(TemplateDecl *Template, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc)
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
Definition: SemaCast.cpp:397
void AddTemplateParametersToLambdaCallOperator(CXXMethodDecl *CallOperator, CXXRecordDecl *Class, TemplateParameterList *TemplateParams)
Definition: SemaLambda.cpp:957
CXXConstructorDecl * DeclareImplicitMoveConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit move constructor for the given class.
void CodeCompletePreprocessorMacroArgument(Scope *S, IdentifierInfo *Macro, MacroInfo *MacroInfo, unsigned Argument)
class clang::Sema::DelayedDiagnostics DelayedDiagnostics
void AddBuiltinCandidate(QualType *ParamTys, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool IsAssignmentOperator=false, unsigned NumContextualBoolArguments=0)
AddBuiltinCandidate - Add a candidate for a built-in operator.
llvm::SmallPtrSet< ConstantExpr *, 4 > FailedImmediateInvocations
Definition: Sema.h:6610
void deduceOpenCLAddressSpace(ValueDecl *decl)
Definition: SemaDecl.cpp:7084
ExprResult ActOnCharacterConstant(const Token &Tok, Scope *UDLScope=nullptr)
Definition: SemaExpr.cpp:3856
ObjCCategoryImplDecl * ActOnStartCategoryImplementation(SourceLocation AtCatImplLoc, const IdentifierInfo *ClassName, SourceLocation ClassLoc, const IdentifierInfo *CatName, SourceLocation CatLoc, const ParsedAttributesView &AttrList)
ActOnStartCategoryImplementation - Perform semantic checks on the category implementation declaration...
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
Definition: SemaStmt.cpp:3324
PragmaStack< FPOptionsOverride > FpPragmaStack
Definition: Sema.h:1420
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
FunctionDecl * InstantiateFunctionDeclaration(FunctionTemplateDecl *FTD, const TemplateArgumentList *Args, SourceLocation Loc, CodeSynthesisContext::SynthesisKind CSC=CodeSynthesisContext::ExplicitTemplateArgumentSubstitution)
Instantiate (or find existing instantiation of) a function template with a given set of template argu...
DefaultedComparisonKind getDefaultedComparisonKind(const FunctionDecl *FD)
Definition: Sema.h:6522
IntelNamedSubGroupSizeAttr * MergeIntelNamedSubGroupSizeAttr(Decl *D, const IntelNamedSubGroupSizeAttr &A)
void SetFunctionBodyKind(Decl *D, SourceLocation Loc, FnBodyKind BodyKind, StringLiteral *DeletedMessage=nullptr)
static SourceRange getPrintable(const Expr *E)
Definition: Sema.h:11641
PragmaStack< StringLiteral * > CodeSegStack
Definition: Sema.h:1414
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, Scope *CurScope)
Definition: SemaStmt.cpp:3976
void AddRangeBasedOptnone(FunctionDecl *FD)
Only called on function definitions; if there is a pragma in scope with the effect of a range-based o...
Definition: SemaAttr.cpp:1177
void referenceDLLExportedClassMethods()
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
void CheckCompleteDestructorVariant(SourceLocation CurrentLocation, CXXDestructorDecl *Dtor)
Do semantic checks to allow the complete destructor variant to be emitted when the destructor is defi...
NamedDecl * ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, MultiTemplateParamsArg TemplateParameterLists, Expr *BitfieldWidth, const VirtSpecifiers &VS, InClassInitStyle InitStyle)
ActOnCXXMemberDeclarator - This is invoked when a C++ class member declarator is parsed.
void MarkCaptureUsedInEnclosingContext(ValueDecl *Capture, SourceLocation Loc, unsigned CapturingScopeIndex)
Definition: SemaExpr.cpp:18769
void AddSYCLUsesAspectsAttr(Decl *D, const AttributeCommonInfo &CI, Expr **Exprs, unsigned Size)
bool CheckIfOverriddenFunctionIsMarkedFinal(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckForFunctionMarkedFinal - Checks whether a virtual member function overrides a virtual member fun...
static NamedDecl * getAsTemplateNameDecl(NamedDecl *D, bool AllowFunctionTemplates=true, bool AllowDependent=true)
Try to interpret the lookup result D as a template-name.
void AddArgumentDependentLookupCandidates(DeclarationName Name, SourceLocation Loc, ArrayRef< Expr * > Args, TemplateArgumentListInfo *ExplicitTemplateArgs, OverloadCandidateSet &CandidateSet, bool PartialOverloading=false)
Add function candidates found via argument-dependent lookup to the set of overloading candidates.
void setFunctionHasBranchIntoScope()
Definition: Sema.cpp:2396
Decl * ActOnProperty(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, ObjCDeclSpec &ODS, Selector GetterSel, Selector SetterSel, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
ExprResult BuildCXXAssumeExpr(Expr *Assumption, const IdentifierInfo *AttrName, SourceRange Range)
ExtVectorDeclsType ExtVectorDecls
ExtVectorDecls - This is a list all the extended vector types.
Definition: Sema.h:3603
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
Definition: SemaStmt.cpp:464
void WarnExactTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
WarnExactTypedMethods - This routine issues a warning if method implementation declaration matches ex...
SourceLocation getOptimizeOffPragmaLocation() const
Get the location for the currently active "\#pragma clang optimize off". If this location is invalid,...
Definition: Sema.h:1491
NamedDecl * HandleDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists)
Definition: SemaDecl.cpp:6419
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, AllowFoldKind CanFold=NoFold)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
Definition: SemaExpr.cpp:17524
void ActOnPragmaMSComment(SourceLocation CommentLoc, PragmaMSCommentKind Kind, StringRef Arg)
ActOnPragmaMSComment - Called on well formed #pragma comment(kind, "arg").
Definition: SemaAttr.cpp:518
TemplateParameterList * MatchTemplateParametersToScopeSpecifier(SourceLocation DeclStartLoc, SourceLocation DeclLoc, const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId, ArrayRef< TemplateParameterList * > ParamLists, bool IsFriend, bool &IsMemberSpecialization, bool &Invalid, bool SuppressDiagnostic=false)
Match the given template parameter lists to the given scope specifier, returning the template paramet...
virtual void anchor()
This virtual key function only exists to limit the emission of debug info describing the Sema class.
Definition: Sema.cpp:268
void CodeCompleteObjCAtExpression(Scope *S)
QualType BuildExtVectorType(QualType T, Expr *ArraySize, SourceLocation AttrLoc)
Build an ext-vector type.
Definition: SemaType.cpp:2860
void handleTagNumbering(const TagDecl *Tag, Scope *TagScope)
Definition: SemaDecl.cpp:4965
SmallVector< AlignPackIncludeState, 8 > AlignPackIncludeStack
Definition: Sema.h:1409
void AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl)
AddImplicitlyDeclaredMembersToClass - Adds any implicitly-declared special functions,...
bool tryResolveExplicitSpecifier(ExplicitSpecifier &ExplicitSpec)
tryResolveExplicitSpecifier - Attempt to resolve the explict specifier.
SimplerImplicitMoveMode
Definition: Sema.h:8784
Expr * BuildBuiltinCallExpr(SourceLocation Loc, Builtin::ID Id, MultiExprArg CallArgs)
BuildBuiltinCallExpr - Create a call to a builtin function specified by Id.
Definition: SemaExpr.cpp:6919
void AddAlignmentAttributesForRecord(RecordDecl *RD)
AddAlignmentAttributesForRecord - Adds any needed alignment attributes to a the record decl,...
Definition: SemaAttr.cpp:53
Decl * ActOnConversionDeclarator(CXXConversionDecl *Conversion)
ActOnConversionDeclarator - Called by ActOnDeclarator to complete the declaration of the given C++ co...
WebAssemblyImportModuleAttr * mergeImportModuleAttr(Decl *D, const WebAssemblyImportModuleAttr &AL)
void CheckMain(FunctionDecl *FD, const DeclSpec &D)
Definition: SemaDecl.cpp:12565
void AddKnownFunctionAttributes(FunctionDecl *FD)
Adds any function attributes that we know a priori based on the declaration of this function.
Definition: SemaDecl.cpp:16872
void DiagnoseUnusedButSetDecl(const VarDecl *VD, DiagReceiverTy DiagReceiver)
If VD is set but not otherwise used, diagnose, for a parameter or a variable.
Definition: SemaDecl.cpp:2155
ExprResult SubstInitializer(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs, bool CXXDirectInit)
ExprResult LookupInlineAsmIdentifier(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool IsUnevaluatedContext)
QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool AllowBothBool, bool AllowBoolConversion, bool AllowBoolOperation, bool ReportInvalid)
type checking for vector binary operators.
Definition: SemaExpr.cpp:10595
void ActOnComment(SourceRange Comment)
Definition: Sema.cpp:2494
ExprResult ActOnDesignatedInitializer(Designation &Desig, SourceLocation EqualOrColonLoc, bool GNUSyntax, ExprResult Init)
Definition: SemaInit.cpp:3368
@ Other
C++26 [dcl.fct.def.general]p1 function-body: ctor-initializer[opt] compound-statement function-try-bl...
LiteralOperatorLookupResult LookupLiteralOperator(Scope *S, LookupResult &R, ArrayRef< QualType > ArgTys, bool AllowRaw, bool AllowTemplate, bool AllowStringTemplate, bool DiagnoseMissing, StringLiteral *StringLit=nullptr)
LookupLiteralOperator - Determine which literal operator should be used for a user-defined literal,...
QualType BuildStdInitializerList(QualType Element, SourceLocation Loc)
Looks for the std::initializer_list template and instantiates it with Element, or emits an error if i...
void CodeCompleteObjCPropertySynthesizeIvar(Scope *S, IdentifierInfo *PropertyName)
bool RequireStructuralType(QualType T, SourceLocation Loc)
Require the given type to be a structural type, and diagnose if it is not.
ExprResult VerifyBitField(SourceLocation FieldLoc, const IdentifierInfo *FieldName, QualType FieldTy, bool IsMsStruct, Expr *BitWidth)
VerifyBitField - verifies that a bit field expression is an ICE and has the correct width,...
Definition: SemaDecl.cpp:18591
concepts::Requirement * ActOnSimpleRequirement(Expr *E)
MemInitResult BuildMemberInitializer(ValueDecl *Member, Expr *Init, SourceLocation IdLoc)
StmtResult ActOnExprStmt(ExprResult Arg, bool DiscardedValue=true)
Definition: SemaStmt.cpp:52
FieldDecl * HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, InClassInitStyle InitStyle, AccessSpecifier AS)
HandleField - Analyze a field of a C struct or a C++ data member.
Definition: SemaDecl.cpp:18691
void ActOnEndOfTranslationUnit()
ActOnEndOfTranslationUnit - This is called at the very end of the translation unit when EOF is reache...
Definition: Sema.cpp:1162
ObjCImplementationDecl * ActOnStartClassImplementation(SourceLocation AtClassImplLoc, const IdentifierInfo *ClassName, SourceLocation ClassLoc, const IdentifierInfo *SuperClassname, SourceLocation SuperClassLoc, const ParsedAttributesView &AttrList)
ExprResult EvaluateConvertedConstantExpression(Expr *E, QualType T, APValue &Value, CCEKind CCE, bool RequireInt, const APValue &PreNarrowingValue)
EvaluateConvertedConstantExpression - Evaluate an Expression That is a converted constant expression ...
FPOptionsOverride CurFPFeatureOverrides()
Definition: Sema.h:1421
void DiagnoseHiddenVirtualMethods(CXXMethodDecl *MD)
Diagnose methods which overload virtual methods in a base class without overriding any.
bool isValidSveBitcast(QualType srcType, QualType destType)
Are the two types SVE-bitcast-compatible types? I.e.
Definition: SemaExpr.cpp:7791
void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD)
ExprResult ActOnDependentIdExpression(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, bool isAddressOfOperand, const TemplateArgumentListInfo *TemplateArgs)
ActOnDependentIdExpression - Handle a dependent id-expression that was just parsed.
QualType NSNumberPointer
Pointer to NSNumber type (NSNumber *).
Definition: Sema.h:12389
ObjCLiteralKind CheckLiteralKind(Expr *FromE)
Definition: SemaExpr.cpp:12098
void CodeCompleteLambdaIntroducer(Scope *S, LambdaIntroducer &Intro, bool AfterAmpersand)
void addInitCapture(sema::LambdaScopeInfo *LSI, VarDecl *Var, bool ByRef)
Add an init-capture to a lambda scope.
Definition: SemaLambda.cpp:835
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt=std::nullopt)
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
Definition: SemaExpr.cpp:20490
FieldDecl * BuildCaptureField(RecordDecl *RD, const sema::Capture &Capture)
Build a FieldDecl suitable to hold the given capture.
ObjCMethodDecl * LookupMethodInQualifiedType(Selector Sel, const ObjCObjectPointerType *OPT, bool IsInstance)
LookupMethodInQualifiedType - Lookups up a method in protocol qualifier list of a qualified objective...
concepts::Requirement * ActOnCompoundRequirement(Expr *E, SourceLocation NoexceptLoc)
void ActOnPragmaMSSeg(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, StringLiteral *SegmentName, llvm::StringRef PragmaName)
Called on well formed #pragma bss_seg/data_seg/const_seg/code_seg.
Definition: SemaAttr.cpp:747
UsingShadowDecl * BuildUsingShadowDecl(Scope *S, BaseUsingDecl *BUD, NamedDecl *Target, UsingShadowDecl *PrevDecl)
Builds a shadow declaration corresponding to a 'using' declaration.
void CheckThreadLocalForLargeAlignment(VarDecl *VD)
Definition: SemaDecl.cpp:14879
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
Definition: SemaExpr.cpp:16182
bool ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, const DeclSpec &DS, SourceLocation ColonColonLoc)
bool checkTargetClonesAttrString(SourceLocation LiteralLoc, StringRef Str, const StringLiteral *Literal, Decl *D, bool &HasDefault, bool &HasCommas, bool &HasNotDefault, SmallVectorImpl< SmallString< 64 >> &StringsBuffer)
bool hasVisibleExplicitSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is an explicit specialization declaration for a...
bool IsInsideALocalClassWithinATemplateFunction()
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool *NoArrowOperatorFound=nullptr)
BuildOverloadedArrowExpr - Build a call to an overloaded operator-> (if one exists),...
ExprResult BuildCallToMemberFunction(Scope *S, Expr *MemExpr, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false, bool AllowRecovery=false)
BuildCallToMemberFunction - Build a call to a member function.
SYCLIntelInitiationIntervalAttr * BuildSYCLIntelInitiationIntervalAttr(const AttributeCommonInfo &CI, Expr *E)
Decl * ActOnTemplateDeclarator(Scope *S, MultiTemplateParamsArg TemplateParameterLists, Declarator &D)
void ActOnTranslationUnitScope(Scope *S)
Scope actions.
Definition: Sema.cpp:131
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)
Look up a name, looking for a single declaration.
void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto, const MultiLevelTemplateArgumentList &Args)
void ActOnReenterFunctionContext(Scope *S, Decl *D)
Push the parameters of D, which must be a function, into scope.
Definition: SemaDecl.cpp:1455
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
bool isMemberAccessibleForDeletion(CXXRecordDecl *NamingClass, DeclAccessPair Found, QualType ObjectType, SourceLocation Loc, const PartialDiagnostic &Diag)
Is the given member accessible for the purposes of deciding whether to define a special member functi...
ObjCPropertyDecl * HandlePropertyInClassExtension(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc, Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite, unsigned &Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind)
Called by ActOnProperty to handle @property declarations in class extensions.
sema::LambdaScopeInfo * RebuildLambdaScopeInfo(CXXMethodDecl *CallOperator)
Definition: SemaDecl.cpp:15757
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
Definition: SemaExpr.cpp:16835
IdentifierInfo * getSuperIdentifier() const
Definition: Sema.cpp:2780
LoopUnrollHintAttr * BuildLoopUnrollHintAttr(const AttributeCommonInfo &A, Expr *E)
Decl * ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef< Decl * > allMethods=std::nullopt, ArrayRef< DeclGroupPtrTy > allTUVars=std::nullopt)
StmtResult BuildIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
Definition: SemaStmt.cpp:982
SYCLIntelMaxConcurrencyAttr * BuildSYCLIntelMaxConcurrencyAttr(const AttributeCommonInfo &CI, Expr *E)
FunctionDecl * getCurFunctionDecl(bool AllowLambda=false) const
Returns a pointer to the innermost enclosing function, or nullptr if the current context is not insid...
Definition: Sema.cpp:1541
ExprResult PerformContextualImplicitConversion(SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter)
Perform a contextual implicit conversion.
void ActOnPragmaFloatControl(SourceLocation Loc, PragmaMsStackAction Action, PragmaFloatControlKind Value)
ActOnPragmaFloatControl - Call on well-formed #pragma float_control.
Definition: SemaAttr.cpp:561
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
Definition: SemaStmt.cpp:4340
ExprResult UsualUnaryConversions(Expr *E)
UsualUnaryConversions - Performs various conversions that are common to most operators (C99 6....
Definition: SemaExpr.cpp:864
MSInheritanceAttr * mergeMSInheritanceAttr(Decl *D, const AttributeCommonInfo &CI, bool BestCase, MSInheritanceModel Model)
LateParsedTemplateMapT LateParsedTemplateMap
Definition: Sema.h:9018
void UnmarkAsLateParsedTemplate(FunctionDecl *FD)
const AttributedType * getCallingConvAttributedType(QualType T) const
Get the outermost AttributedType node that sets a calling convention.
Definition: SemaDecl.cpp:3589
CheckTemplateArgumentKind
Specifies the context in which a particular template argument is being checked.
Definition: Sema.h:9366
@ CTAK_DeducedFromArrayBound
The template argument was deduced from an array bound via template argument deduction.
Definition: Sema.h:9377
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
Definition: Sema.h:9369
@ CTAK_Deduced
The template argument was deduced via template argument deduction.
Definition: Sema.h:9373
bool SubstExprs(ArrayRef< Expr * > Exprs, bool IsCall, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< Expr * > &Outputs)
Substitute the given template arguments into a list of expressions, expanding pack expansions if requ...
BaseResult ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange, const ParsedAttributesView &Attrs, bool Virtual, AccessSpecifier Access, ParsedType basetype, SourceLocation BaseLoc, SourceLocation EllipsisLoc)
ActOnBaseSpecifier - Parsed a base specifier.
TypeSpecifierType isTagName(IdentifierInfo &II, Scope *S)
isTagName() - This method is called for error recovery purposes only to determine if the specified na...
Definition: SemaDecl.cpp:647
void ActOnFinishFunctionDeclarationDeclarator(Declarator &D)
Called after parsing a function declarator belonging to a function declaration.
void ActOnPragmaMSPointersToMembers(LangOptions::PragmaMSPointersToMembersKind Kind, SourceLocation PragmaLoc)
ActOnPragmaMSPointersToMembers - called on well formed #pragma pointers_to_members(representation met...
Definition: SemaAttr.cpp:615
bool CheckRedeclarationExported(NamedDecl *New, NamedDecl *Old)
Definition: SemaDecl.cpp:1690
SYCLIntelLoopFuseAttr * MergeSYCLIntelLoopFuseAttr(Decl *D, const SYCLIntelLoopFuseAttr &A)
void CodeCompletePostfixExpression(Scope *S, ExprResult LHS, QualType PreferredType)
TypeResult actOnObjCTypeArgsAndProtocolQualifiers(Scope *S, SourceLocation Loc, ParsedType BaseType, SourceLocation TypeArgsLAngleLoc, ArrayRef< ParsedType > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< Decl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc)
Build a specialized and/or protocol-qualified Objective-C type.
Definition: SemaType.cpp:1164
ExprResult CheckUnevaluatedOperand(Expr *E)
void CheckTemplatePartialSpecialization(ClassTemplatePartialSpecializationDecl *Partial)
void ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc, Expr *defarg)
ActOnParamDefaultArgument - Check whether the default argument provided for a function parameter is w...
bool DisableTypoCorrection
Tracks whether we are in a context where typo correction is disabled.
Definition: Sema.h:7479
void CheckConversionDeclarator(Declarator &D, QualType &R, StorageClass &SC)
CheckConversionDeclarator - Called by ActOnDeclarator to check the well-formednes of the conversion f...
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression.
OpenCLUnrollHintAttr * BuildOpenCLLoopUnrollHintAttr(const AttributeCommonInfo &A, Expr *E)
ExprResult DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, FunctionDecl *FDecl)
DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but will create a trap if the resul...
Definition: SemaExpr.cpp:1114
void CodeCompleteObjCClassForwardDecl(Scope *S)
void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc)
Definition: SemaExpr.cpp:14266
DeclGroupPtrTy ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, ModuleDeclKind MDK, ModuleIdPath Path, ModuleIdPath Partition, ModuleImportState &ImportState)
The parser has processed a module-declaration that begins the definition of a module interface or imp...
Definition: SemaModule.cpp:258
TemplateNameKind isTemplateName(Scope *S, CXXScopeSpec &SS, bool hasTemplateKeyword, const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool &MemberOfUnknownSpecialization, bool Disambiguation=false)
llvm::DenseMap< NamedDecl *, NamedDecl * > VisibleNamespaceCache
Map from the most recent declaration of a namespace to the most recent visible declaration of that na...
Definition: Sema.h:10452
ExprResult tryConvertExprToType(Expr *E, QualType Ty)
Try to convert an expression E to type Ty.
Definition: SemaExpr.cpp:5294
Decl * ActOnFileScopeAsmDecl(Expr *expr, SourceLocation AsmLoc, SourceLocation RParenLoc)
Definition: SemaDecl.cpp:20675
bool hasMergedDefinitionInCurrentModule(const NamedDecl *Def)
bool DeduceReturnType(FunctionDecl *FD, SourceLocation Loc, bool Diagnose=true)
std::vector< Token > ExpandFunctionLocalPredefinedMacros(ArrayRef< Token > Toks)
Definition: SemaExpr.cpp:2071
StmtResult SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs)
bool CheckMatrixCast(SourceRange R, QualType DestTy, QualType SrcTy, CastKind &Kind)
Definition: SemaExpr.cpp:7934
QualType CheckAddressOfOperand(ExprResult &Operand, SourceLocation OpLoc)
CheckAddressOfOperand - The operand of & must be either a function designator or an lvalue designatin...
Definition: SemaExpr.cpp:14556
ParsedTemplateArgument ActOnTemplateTypeArgument(TypeResult ParsedType)
Convert a parsed type into a parsed template argument.
ParmVarDecl * BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T)
Synthesizes a variable for a parameter arising from a typedef.
Definition: SemaDecl.cpp:15381
ExprResult CheckSwitchCondition(SourceLocation SwitchLoc, Expr *Cond)
Definition: SemaStmt.cpp:1058
bool DiagnoseUnknownTemplateName(const IdentifierInfo &II, SourceLocation IILoc, Scope *S, const CXXScopeSpec *SS, TemplateTy &SuggestedTemplate, TemplateNameKind &SuggestedKind)
Decl * ActOnCompatibilityAlias(SourceLocation AtCompatibilityAliasLoc, IdentifierInfo *AliasName, SourceLocation AliasLocation, IdentifierInfo *ClassName, SourceLocation ClassLocation)
ActOnCompatibilityAlias - this action is called after complete parsing of a @compatibility_alias decl...
ASTContext & Context
Definition: Sema.h:859
static bool TooManyArguments(size_t NumParams, size_t NumArgs, bool PartialOverloading=false)
To be used for checking whether the arguments being passed to function exceeds the number of paramete...
Definition: Sema.h:6435
bool IsQualificationConversion(QualType FromType, QualType ToType, bool CStyle, bool &ObjCLifetimeConversion)
IsQualificationConversion - Determines whether the conversion from an rvalue of type FromType to ToTy...
void diagnoseNullableToNonnullConversion(QualType DstType, QualType SrcType, SourceLocation Loc)
Warn if we're implicitly casting from a _Nullable pointer type to a _Nonnull one.
Definition: Sema.cpp:609
bool ShouldSplatAltivecScalarInCast(const VectorType *VecTy)
Definition: SemaCast.cpp:2709
QualType InvalidOperands(SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
the following "Check" methods will return a valid/converted QualType or a null QualType (indicating a...
Definition: SemaExpr.cpp:10290
bool DiagIfReachable(SourceLocation Loc, ArrayRef< const Stmt * > Stmts, const PartialDiagnostic &PD)
Conditionally issue a diagnostic based on the statements's reachability analysis.
Definition: SemaExpr.cpp:20501
void FinalizeDeclaration(Decl *D)
FinalizeDeclaration - called by ParseDeclarationAfterDeclarator to perform any semantic actions neces...
Definition: SemaDecl.cpp:14901
ExprResult ActOnCoyieldExpr(Scope *S, SourceLocation KwLoc, Expr *E)
bool ConstraintExpressionDependsOnEnclosingTemplate(const FunctionDecl *Friend, unsigned TemplateDepth, const Expr *Constraint)
bool CheckTemplatePartialSpecializationArgs(SourceLocation Loc, TemplateDecl *PrimaryTemplate, unsigned NumExplicitArgs, ArrayRef< TemplateArgument > Args)
Check the non-type template arguments of a class template partial specialization according to C++ [te...
ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc)
ActOnCXXNullPtrLiteral - Parse 'nullptr'.
void ActOnCapturedRegionError()
Definition: SemaStmt.cpp:4944
void ActOnFinishDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnFinishDelayedCXXMethodDeclaration - We have finished processing the delayed method declaration f...
ARCConversionResult
Definition: Sema.h:12595
@ ACR_error
Definition: Sema.h:12595
@ ACR_unbridged
Definition: Sema.h:12595
@ ACR_okay
Definition: Sema.h:12595
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
IdentifierSourceLocations TypoCorrectionFailures
A cache containing identifiers for which typo correction failed and their locations,...
Definition: Sema.h:7490
FullExprArg MakeFullExpr(Expr *Arg, SourceLocation CC)
Definition: Sema.h:6013
QualType BuildFunctionType(QualType T, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc, DeclarationName Entity, const FunctionProtoType::ExtProtoInfo &EPI)
Build a function type.
Definition: SemaType.cpp:3099
QualType CheckShiftOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, bool IsCompAssign=false)
Definition: SemaExpr.cpp:11925
void ActOnPragmaUnused(const Token &Identifier, Scope *curScope, SourceLocation PragmaLoc)
ActOnPragmaUnused - Called on well-formed '#pragma unused'.
Definition: SemaAttr.cpp:835
DeclarationNameInfo GetNameForDeclarator(Declarator &D)
GetNameForDeclarator - Determine the full declaration name for the given Declarator.
Definition: SemaDecl.cpp:5957
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
bool InNonInstantiationSFINAEContext
Whether we are in a SFINAE context that is not associated with template instantiation.
Definition: Sema.h:10459
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
void DiagnoseUnusedBackingIvarInAccessor(Scope *S, const ObjCImplementationDecl *ImplD)
DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which backs the property is n...
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, const Scope *S, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
Definition: SemaExpr.cpp:3014
static FormatStringType GetFormatStringType(const FormatAttr *Format)
ExprResult MaybeConvertParenListExprToParenExpr(Scope *S, Expr *ME)
This is not an AltiVec-style cast or or C++ direct-initialization, so turn the ParenListExpr into a s...
Definition: SemaExpr.cpp:8201
concepts::TypeRequirement * BuildTypeRequirement(TypeSourceInfo *Type)
void ActOnFinishTopLevelStmtDecl(TopLevelStmtDecl *D, Stmt *Statement)
Definition: SemaDecl.cpp:20696
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, std::optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
Preprocessor & getPreprocessor() const
Definition: Sema.h:527
bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function, bool Complain=false, SourceLocation Loc=SourceLocation())
Returns whether the given function's address can be taken or not, optionally emitting a diagnostic if...
void ActOnAnnotModuleEnd(SourceLocation DirectiveLoc, Module *Mod)
The parser has left a submodule.
Definition: SemaModule.cpp:783
void * SkippedDefinitionContext
Definition: Sema.h:3254
ExprResult BuildExpressionFromNonTypeTemplateArgument(const TemplateArgument &Arg, SourceLocation Loc)
bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:11894
AccessResult CheckDestructorAccess(SourceLocation Loc, CXXDestructorDecl *Dtor, const PartialDiagnostic &PDiag, QualType objectType=QualType())
ExprResult checkPseudoObjectAssignment(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opcode, Expr *LHS, Expr *RHS)
bool CheckCaseExpression(Expr *E)
Definition: SemaExpr.cpp:21461
void resetFPOptions(FPOptions FPO)
Definition: Sema.h:8996
bool hasAcceptableDefinition(NamedDecl *D, AcceptableKind Kind)
Definition: Sema.h:11967
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
Definition: SemaStmt.cpp:4440
ObjCProtocolDecl * LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, RedeclarationKind Redecl=RedeclarationKind::NotForRedeclaration)
Find the protocol with the given name, if any.
QualType ProduceTemplateArgumentSignatureHelp(TemplateTy, ArrayRef< ParsedTemplateArgument >, SourceLocation LAngleLoc)
bool isObjCPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType, bool &IncompatibleObjC)
isObjCPointerConversion - Determines whether this is an Objective-C pointer conversion.
bool currentModuleIsImplementation() const
Is the module scope we are an implementation unit?
Definition: Sema.h:7913
DeclResult ActOnModuleImport(SourceLocation StartLoc, SourceLocation ExportLoc, SourceLocation ImportLoc, ModuleIdPath Path, bool IsPartition=false)
The parser has processed a module import declaration.
Definition: SemaModule.cpp:572
Decl * ActOnUsingEnumDeclaration(Scope *CurScope, AccessSpecifier AS, SourceLocation UsingLoc, SourceLocation EnumLoc, SourceLocation IdentLoc, IdentifierInfo &II, CXXScopeSpec *SS=nullptr)
void CodeCompleteAfterIf(Scope *S, bool IsBracedThen)
static bool getPrintable(bool B)
Definition: Sema.h:11630
bool LookupBuiltin(LookupResult &R)
Lookup a builtin function, when name lookup would otherwise fail.
Definition: SemaLookup.cpp:945
bool AnyWorkGroupSizesDiffer(const Expr *LHSXDim, const Expr *LHSYDim, const Expr *LHSZDim, const Expr *RHSXDim, const Expr *RHSYDim, const Expr *RHSZDim)
std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const
ExprResult SubstConstraintExprWithoutSatisfaction(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
void propagateDLLAttrToBaseClassTemplate(CXXRecordDecl *Class, Attr *ClassAttr, ClassTemplateSpecializationDecl *BaseTemplateSpec, SourceLocation BaseLoc)
Perform propagation of DLL attributes from a derived class to a templated base class for MS compatibi...
void DiagPlaceholderFieldDeclDefinitions(RecordDecl *Record)
Emit diagnostic warnings for placeholder members.
Definition: SemaDecl.cpp:5470
NamedDecl * ActOnFriendFunctionDecl(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParams)
void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec, TypedefNameDecl *NewTD)
Definition: SemaDecl.cpp:5075
QualType CheckMatrixElementwiseOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
Type checking for matrix binary operators.
Definition: SemaExpr.cpp:13397
bool tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD, bool ForceComplain=false, bool(*IsPlausibleResult)(QualType)=nullptr)
Try to recover by turning the given expression into a call.
Definition: Sema.cpp:2735
FunctionDecl * ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, QualType TargetType, bool Complain, DeclAccessPair &Found, bool *pHadMultipleCandidates=nullptr)
ResolveAddressOfOverloadedFunction - Try to resolve the address of an overloaded function (C++ [over....
void ActOnSuperClassOfClassInterface(Scope *S, SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *IDecl, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange)
bool FunctionParamTypesAreEqual(ArrayRef< QualType > Old, ArrayRef< QualType > New, unsigned *ArgPos=nullptr, bool Reversed=false)
FunctionParamTypesAreEqual - This routine checks two function proto types for equality of their param...
SemaDiagnosticBuilder::DeferredDiagnosticsType DeviceDeferredDiags
Diagnostics that are emitted only if we discover that the given function must be codegen'ed.
Definition: Sema.h:994
void CheckDelayedMemberExceptionSpecs()
void AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *MaxThreads, Expr *MinBlocks, Expr *MaxBlocks)
AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular declaration.
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType=nullptr)
Definition: SemaDecl.cpp:67
void ActOnReenterCXXMethodParameter(Scope *S, ParmVarDecl *Param)
This is used to implement the constant expression evaluation part of the attribute enable_if extensio...
void addAMDGPUWavesPerEUAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a particular declaration.
AllowFoldKind
Definition: Sema.h:5959
@ AllowFold
Definition: Sema.h:5961
@ NoFold
Definition: Sema.h:5960
SYCLIntelSpeculatedIterationsAttr * BuildSYCLIntelSpeculatedIterationsAttr(const AttributeCommonInfo &CI, Expr *E)
void InstantiateMemInitializers(CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl, const MultiLevelTemplateArgumentList &TemplateArgs)
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
Definition: SemaDecl.cpp:1522
ParsedType getDestructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
ClassTemplateDecl * StdCoroutineTraitsCache
The C++ "std::coroutine_traits" template, which is defined in <coroutine_traits>
Definition: Sema.h:2299
bool DeclareRISCVSiFiveVectorBuiltins
Indicate RISC-V SiFive vector builtin functions enabled or not.
Definition: Sema.h:13016
PragmaStack< bool > StrictGuardStackCheckStack
Definition: Sema.h:1417
void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S, UnresolvedSetImpl &Functions)
void checkSpecializationReachability(SourceLocation Loc, NamedDecl *Spec)
UnusedFileScopedDeclsType UnusedFileScopedDecls
The set of file scoped decls seen so far that have not been used and must warn if not used.
Definition: Sema.h:2634
ObjCInterfaceDecl * NSStringDecl
The declaration of the Objective-C NSString class.
Definition: Sema.h:12398
bool hasVisibleDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if the template parameter D has a visible default argument.
void CleanupVarDeclMarking()
Definition: SemaExpr.cpp:19969
void CodeCompleteAvailabilityPlatformName()
bool CheckConstraintExpression(const Expr *CE, Token NextToken=Token(), bool *PossibleNonPrimary=nullptr, bool IsTrailingRequiresClause=false)
Check whether the given expression is a valid constraint expression.
Definition: SemaConcept.cpp:91
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
Definition: SemaExpr.cpp:830
bool isImmediateFunctionContext() const
Definition: Sema.h:6460
NamedDecl * LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, Scope *S, bool ForRedeclaration, SourceLocation Loc)
LazilyCreateBuiltin - The specified Builtin-ID was first used at file scope.
Definition: SemaDecl.cpp:2441
void AddSYCLWorkGroupSizeHintAttr(Decl *D, const AttributeCommonInfo &CI, Expr *XDim, Expr *YDim, Expr *ZDim)
ExprResult CallExprUnaryConversions(Expr *E)
CallExprUnaryConversions - a special case of an unary conversion performed on a function designator o...
Definition: SemaExpr.cpp:842
void translateTemplateArguments(const ASTTemplateArgsPtr &In, TemplateArgumentListInfo &Out)
Translates template arguments as provided by the parser into template arguments used by semantic anal...
void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return, ArrayRef< QualType > Params)
DeclareGlobalAllocationFunction - Declares a single implicit global allocation function if it doesn't...
ExprResult VerifyIntegerConstantExpression(Expr *E, AllowFoldKind CanFold=NoFold)
Definition: Sema.h:5976
UnresolvedSetIterator getMostSpecialized(UnresolvedSetIterator SBegin, UnresolvedSetIterator SEnd, TemplateSpecCandidateSet &FailedCandidates, SourceLocation Loc, const PartialDiagnostic &NoneDiag, const PartialDiagnostic &AmbigDiag, const PartialDiagnostic &CandidateDiag, bool Complain=true, QualType TargetType=QualType())
Retrieve the most specialized of the given function template specializations.
bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType)
IsIntegralPromotion - Determines whether the conversion from the expression From (whose potentially-a...
bool DiagnoseUnexpandedParameterPackInRequiresExpr(RequiresExpr *RE)
If the given requirees-expression contains an unexpanded reference to one of its own parameter packs,...
TypeSourceInfo * SubstType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, bool AllowDeducedTST=false)
Perform substitution on the type T with a given set of template arguments.
void CheckCoroutineWrapper(FunctionDecl *FD)
Definition: SemaDecl.cpp:16187
bool IsFloatingPointPromotion(QualType FromType, QualType ToType)
IsFloatingPointPromotion - Determines whether the conversion from FromType to ToType is a floating po...
bool checkMSInheritanceAttrOnDefinition(CXXRecordDecl *RD, SourceRange Range, bool BestCase, MSInheritanceModel SemanticSpelling)
void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod, ObjCInterfaceDecl *CurrentClass, ResultTypeCompatibilityKind RTC)
ClassTemplateDecl * StdInitializerList
The C++ "std::initializer_list" template, which is defined in <initializer_list>.
Definition: Sema.h:4987
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input, bool IsAfterAmp=false)
Definition: SemaExpr.cpp:16098
void CheckExplicitlyDefaultedFunction(Scope *S, FunctionDecl *MD)
ParsingDeclState PushParsingDeclaration(sema::DelayedDiagnosticPool &pool)
Definition: Sema.h:987
void CodeCompleteObjCPropertyDefinition(Scope *S)
void ActOnPragmaAttributeAttribute(ParsedAttr &Attribute, SourceLocation PragmaLoc, attr::ParsedSubjectMatchRuleSet Rules)
Definition: SemaAttr.cpp:934
bool isCurrentClassName(const IdentifierInfo &II, Scope *S, const CXXScopeSpec *SS=nullptr)
isCurrentClassName - Determine whether the identifier II is the name of the class type currently bein...
bool tryCaptureVariable(ValueDecl *Var, SourceLocation Loc, TryCaptureKind Kind, SourceLocation EllipsisLoc, bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const unsigned *const FunctionScopeIndexToStopAt)
Try to capture the given variable.
Definition: SemaExpr.cpp:19260
AMDGPUMaxNumWorkGroupsAttr * CreateAMDGPUMaxNumWorkGroupsAttr(const AttributeCommonInfo &CI, Expr *XExpr, Expr *YExpr, Expr *ZExpr)
Create an AMDGPUMaxNumWorkGroupsAttr attribute.
void MarkVariableReferenced(SourceLocation Loc, VarDecl *Var)
Mark a variable referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
Definition: SemaExpr.cpp:20220
ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C class message expression.
bool IsRedefinitionInModule(const NamedDecl *New, const NamedDecl *Old) const
Definition: SemaDecl.cpp:1755
void AddSYCLDeviceHasAttr(Decl *D, const AttributeCommonInfo &CI, Expr **Exprs, unsigned Size)
Decl * ActOnStartExportDecl(Scope *S, SourceLocation ExportLoc, SourceLocation LBraceLoc)
We have parsed the start of an export declaration, including the '{' (if present).
Definition: SemaModule.cpp:844
Scope * getCurScope() const
Retrieve the parser's current scope.
Definition: Sema.h:699
void checkExceptionSpecification(bool IsTopLevel, ExceptionSpecificationType EST, ArrayRef< ParsedType > DynamicExceptions, ArrayRef< SourceRange > DynamicExceptionRanges, Expr *NoexceptExpr, SmallVectorImpl< QualType > &Exceptions, FunctionProtoType::ExceptionSpecInfo &ESI)
Check the given exception-specification and update the exception specification information with the r...
SmallVector< std::pair< FunctionDecl *, FunctionDecl * >, 2 > DelayedEquivalentExceptionSpecChecks
All the function redeclarations seen during a class definition that had their exception spec checks d...
Definition: Sema.h:5065
void LookupBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, UnresolvedSetImpl &Functions)
Definition: SemaExpr.cpp:15612
NameClassificationKind
Describes the result of the name lookup and resolution performed by ClassifyName().
Definition: Sema.h:2690
@ NC_Unknown
This name is not a type or template in this context, but might be something else.
Definition: Sema.h:2693
@ NC_VarTemplate
The name was classified as a variable template name.
Definition: Sema.h:2720
@ NC_NonType
The name was classified as a specific non-type, non-template declaration.
Definition: Sema.h:2703
@ NC_TypeTemplate
The name was classified as a template whose specializations are types.
Definition: Sema.h:2718
@ NC_Error
Classification failed; an error has been produced.
Definition: Sema.h:2695
@ NC_FunctionTemplate
The name was classified as a function template name.
Definition: Sema.h:2722
@ NC_DependentNonType
The name denotes a member of a dependent type that could not be resolved.
Definition: Sema.h:2711
@ NC_UndeclaredNonType
The name was classified as an ADL-only function name.
Definition: Sema.h:2707
@ NC_UndeclaredTemplate
The name was classified as an ADL-only function template name.
Definition: Sema.h:2724
@ NC_Keyword
The name has been typo-corrected to a keyword.
Definition: Sema.h:2697
@ NC_Type
The name was classified as a type.
Definition: Sema.h:2699
@ NC_OverloadSet
The name was classified as an overload set, and an expression representing that overload set has been...
Definition: Sema.h:2716
@ NC_Concept
The name was classified as a concept name.
Definition: Sema.h:2726
bool checkThisInStaticMemberFunctionType(CXXMethodDecl *Method)
Check whether 'this' shows up in the type of a static member function after the (naturally empty) cv-...
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
void DiagnoseUnguardedAvailabilityViolations(Decl *FD)
Issue any -Wunguarded-availability warnings in FD.
void PopExpressionEvaluationContext()
Definition: SemaExpr.cpp:18165
AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType, ExprResult &RHS)
Definition: SemaExpr.cpp:10033
NamespaceDecl * getOrCreateStdNamespace()
Retrieve the special "std" namespace, which may require us to implicitly define the namespace.
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
bool CheckTypeTraitArity(unsigned Arity, SourceLocation Loc, size_t N)
PragmaStack< StringLiteral * > ConstSegStack
Definition: Sema.h:1413
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
Definition: SemaStmt.cpp:4678
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CheckedConversionKind::Implicit)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
Definition: Sema.cpp:672
void ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind, SourceLocation PragmaLoc)
ActOnPragmaOptionsAlign - Called on well formed #pragma options align.
Definition: SemaAttr.cpp:230
bool FunctionNonObjectParamTypesAreEqual(const FunctionDecl *OldFunction, const FunctionDecl *NewFunction, unsigned *ArgPos=nullptr, bool Reversed=false)
ExprResult DefaultArgumentPromotion(Expr *E)
DefaultArgumentPromotion (C99 6.5.2.2p6).
Definition: SemaExpr.cpp:947
bool isInitListConstructor(const FunctionDecl *Ctor)
Determine whether Ctor is an initializer-list constructor, as defined in [dcl.init....
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedIdentKind IK)
Definition: SemaExpr.cpp:3804
void ActOnStartFunctionDeclarationDeclarator(Declarator &D, unsigned TemplateParameterDepth)
Called before parsing a function declarator belonging to a function declaration.
ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc, SourceLocation TildeLoc, UnqualifiedId &SecondTypeName)
bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S)
isMicrosoftMissingTypename - In Microsoft mode, within class scope, if a CXXScopeSpec's type is equal...
Definition: SemaDecl.cpp:685
bool isConstantEvaluatedOverride
Used to change context to isConstantEvaluated without pushing a heavy ExpressionEvaluationContextReco...
Definition: Sema.h:1863
ParsingClassState PushParsingClass()
Definition: Sema.h:5010
SmallVector< VarDecl *, 4 > ExternalDeclarations
All the external declarations encoutered and used in the TU.
Definition: Sema.h:2644
bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall)
Check whether the given method, which must be in the 'init' family, is a valid member of that family.
ForRangeStatus
Definition: Sema.h:8525
@ FRS_Success
Definition: Sema.h:8526
@ FRS_DiagnosticIssued
Definition: Sema.h:8528
@ FRS_NoViableFunction
Definition: Sema.h:8527
bool CheckArgsForPlaceholders(MultiExprArg args)
Check an argument list for placeholders that we won't try to handle later.
Definition: SemaExpr.cpp:6446
void ActOnPragmaCXLimitedRange(SourceLocation Loc, LangOptions::ComplexRangeKind Range)
ActOnPragmaCXLimitedRange - Called on well formed #pragma STDC CX_LIMITED_RANGE.
Definition: SemaAttr.cpp:1367
bool UseArgumentDependentLookup(const CXXScopeSpec &SS, const LookupResult &R, bool HasTrailingLParen)
Definition: SemaExpr.cpp:3412
bool isBoundsAttrContext() const
Definition: Sema.h:5345
void ActOnPragmaFPExceptions(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called on well formed '#pragma clang fp' that has option 'exceptions'.
Definition: SemaAttr.cpp:1375
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given variable from its template.
void inferGslPointerAttribute(NamedDecl *ND, CXXRecordDecl *UnderlyingRecord)
Add gsl::Pointer attribute to std::container::iterator.
Definition: SemaAttr.cpp:111
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
Definition: SemaExpr.cpp:7310
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
Definition: SemaExpr.cpp:16150
void MarkAsLateParsedTemplate(FunctionDecl *FD, Decl *FnD, CachedTokens &Toks)
SYCLAddIRAttributesGlobalVariableAttr * MergeSYCLAddIRAttributesGlobalVariableAttr(Decl *D, const SYCLAddIRAttributesGlobalVariableAttr &A)
llvm::SmallVector< DeleteExprLoc, 4 > DeleteLocs
Definition: Sema.h:572
TemplateArgumentLoc getTemplateArgumentPackExpansionPattern(TemplateArgumentLoc OrigLoc, SourceLocation &Ellipsis, std::optional< unsigned > &NumExpansions) const
Returns the pattern of the pack expansion for a template argument.
llvm::SmallSetVector< CXXRecordDecl *, 16 > AssociatedClassSet
Definition: Sema.h:7538
AccessResult CheckAllocationAccess(SourceLocation OperatorLoc, SourceRange PlacementRange, CXXRecordDecl *NamingClass, DeclAccessPair FoundDecl, bool Diagnose=true)
Checks access to an overloaded operator new or delete.
void CodeCompleteUsingDirective(Scope *S)
std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths)
Builds a string representing ambiguous paths from a specific derived class to different subobjects of...
unsigned TyposCorrected
The number of typos corrected by CorrectTypo.
Definition: Sema.h:7482
SYCLDeviceHasAttr * MergeSYCLDeviceHasAttr(Decl *D, const SYCLDeviceHasAttr &A)
bool BuiltinVectorToScalarMath(CallExpr *TheCall)
bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn)
We've just determined that Old and New both appear to be definitions of the same variable.
Definition: SemaDecl.cpp:4920
DefaultedComparisonKind
Kinds of defaulted comparison operator functions.
Definition: Sema.h:4652
@ None
This is not a defaultable comparison operator.
AccessResult CheckMemberOperatorAccess(SourceLocation Loc, Expr *ObjectExpr, const SourceRange &, DeclAccessPair FoundDecl)
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
Definition: SemaExpr.cpp:8217
Module * getOwningModule(const Decl *Entity)
Get the module owning an entity.
Definition: Sema.h:2657
ExprResult ActOnArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, ParsedType LhsTy, Expr *DimExpr, SourceLocation RParen)
ActOnArrayTypeTrait - Parsed one of the binary type trait support pseudo-functions.
QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType)
llvm::SmallVector< QualType, 4 > CurrentParameterCopyTypes
Stack of types that correspond to the parameter entities that are currently being copy-initialized.
Definition: Sema.h:7228
bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType, bool InOverloadResolution, QualType &ConvertedType, bool &IncompatibleObjC)
IsPointerConversion - Determines whether the conversion of the expression From, which has the (possib...
bool RequireLiteralType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a literal type.
Definition: SemaType.cpp:9754
FunctionDecl * ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl, bool Complain=false, DeclAccessPair *Found=nullptr, TemplateSpecCandidateSet *FailedTSC=nullptr)
Given an expression that refers to an overloaded function, try to resolve that overloaded function ex...
AllowedExplicit
Definition: Sema.h:8116
void ActOnFinishRequiresExpr()
void MatchAllMethodDeclarations(const SelectorSet &InsMap, const SelectorSet &ClsMap, SelectorSet &InsMapSeen, SelectorSet &ClsMapSeen, ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl, bool &IncompleteImpl, bool ImmediateClass, bool WarnCategoryMethodImpl=false)
MatchAllMethodDeclarations - Check methods declaraed in interface or or protocol against those declar...
static const unsigned MaxAlignmentExponent
The maximum alignment, same as in llvm::Value.
Definition: Sema.h:798
llvm::PointerIntPair< CXXRecordDecl *, 3, CXXSpecialMemberKind > SpecialMemberDecl
Definition: Sema.h:4998
QualType CheckMatrixMultiplyOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
Definition: SemaExpr.cpp:13443
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, std::optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
void CheckObjCMethodDirectOverrides(ObjCMethodDecl *method, ObjCMethodDecl *overridden)
void ActOnStartCXXInClassMemberInitializer()
Enter a new C++ default initializer scope.
void * SaveNestedNameSpecifierAnnotation(CXXScopeSpec &SS)
Given a C++ nested-name-specifier, produce an annotation value that the parser can use later to recon...
void DiagnoseUseOfDeletedFunction(SourceLocation Loc, SourceRange Range, DeclarationName Name, OverloadCandidateSet &CandidateSet, FunctionDecl *Fn, MultiExprArg Args, bool IsMember=false)
bool shouldIgnoreInHostDeviceCheck(FunctionDecl *Callee)
Definition: SemaDecl.cpp:20877
void CodeCompleteTypeQualifiers(DeclSpec &DS)
NamedDecl * BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, bool HasTypenameKeyword, SourceLocation TypenameLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, SourceLocation EllipsisLoc, const ParsedAttributesView &AttrList, bool IsInstantiation, bool IsUsingIfExists)
Builds a using declaration.
ParsedType ActOnObjCInstanceType(SourceLocation Loc)
The parser has parsed the context-sensitive type 'instancetype' in an Objective-C message declaration...
Definition: SemaType.cpp:6868
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
Definition: Sema.h:776
std::string getFixItZeroInitializerForType(QualType T, SourceLocation Loc) const
Get a string to suggest for zero-initialization of a type.
bool IsComplexPromotion(QualType FromType, QualType ToType)
Determine if a conversion is a complex promotion.
void redelayDiagnostics(sema::DelayedDiagnosticPool &pool)
Decl * BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, AccessSpecifier AS, RecordDecl *Record, const PrintingPolicy &Policy)
BuildAnonymousStructOrUnion - Handle the declaration of an anonymous structure or union.
Definition: SemaDecl.cpp:5627
void ActOnPragmaFPEvalMethod(SourceLocation Loc, LangOptions::FPEvalMethodKind Value)
Definition: SemaAttr.cpp:534
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
bool SubstTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateArgumentListInfo &Outputs)
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
Definition: Sema.cpp:1546
bool isAcceptableTagRedeclaration(const TagDecl *Previous, TagTypeKind NewTag, bool isDefinition, SourceLocation NewTagLoc, const IdentifierInfo *Name)
Determine whether a tag with a given kind is acceptable as a redeclaration of the given tag declarati...
Definition: SemaDecl.cpp:17232
void DiagnoseDeprecatedAttribute(const ParsedAttr &A, StringRef NewScope, StringRef NewName)
Emit a diagnostic about the given attribute having a deprecated name, and also emit a fixit hint to g...
ExprResult ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *expr)
ActOnCXXThrow - Parse throw expressions.
sema::LambdaScopeInfo * getCurGenericLambda()
Retrieve the current generic lambda info, if any.
Definition: Sema.cpp:2485
unsigned InventedParameterInfosStart
The index of the first InventedParameterInfo that refers to the current context.
Definition: Sema.h:2549
void MarkTypoCorrectedFunctionDefinition(const NamedDecl *F)
Definition: SemaDecl.cpp:9240
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
Definition: SemaExpr.cpp:2274
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)
void handleLambdaNumbering(CXXRecordDecl *Class, CXXMethodDecl *Method, std::optional< CXXRecordDecl::LambdaNumbering > NumberingOverride=std::nullopt)
Number lambda for linkage purposes if necessary.
Definition: SemaLambda.cpp:415
bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors, ArrayRef< CXXCtorInitializer * > Initializers=std::nullopt)
unsigned NumSFINAEErrors
The number of SFINAE diagnostics that have been trapped.
Definition: Sema.h:9008
void setFunctionHasIndirectGoto()
Definition: Sema.cpp:2406
void HandleDependentAccessCheck(const DependentDiagnostic &DD, const MultiLevelTemplateArgumentList &TemplateArgs)
void DefineImplicitMoveConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitMoveConstructor - Checks for feasibility of defining this constructor as the move const...
bool CheckHLSLBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall)
QualType BuildBitIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc)
Build a bit-precise integer type.
Definition: SemaType.cpp:2389
TemplateParameterListEqualKind
Enumeration describing how template parameter lists are compared for equality.
Definition: Sema.h:9452
@ TPL_TemplateTemplateParmMatch
We are matching the template parameter lists of two template template parameters as part of matching ...
Definition: Sema.h:9470
@ TPL_TemplateTemplateArgumentMatch
We are matching the template parameter lists of a template template argument against the template par...
Definition: Sema.h:9481
@ TPL_TemplateMatch
We are matching the template parameter lists of two templates that might be redeclarations.
Definition: Sema.h:9460
@ TPL_TemplateParamsEquivalent
We are determining whether the template-parameters are equivalent according to C++ [temp....
Definition: Sema.h:9491
llvm::Error isValidSectionSpecifier(StringRef Str)
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
Definition: SemaExpr.cpp:16438
NamedDecl * ActOnTypeParameter(Scope *S, bool Typename, SourceLocation EllipsisLoc, SourceLocation KeyLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedType DefaultArg, bool HasTypeConstraint)
ActOnTypeParameter - Called when a C++ template type parameter (e.g., "typename T") has been parsed.
EnumDecl * getStdAlignValT() const
void ActOnFinishDelayedMemberDeclarations(Scope *S, Decl *Record)
LangAS getDefaultCXXMethodAddrSpace() const
Returns default addr space for method qualifiers.
Definition: Sema.cpp:1560
QualType BuiltinRemoveReference(QualType BaseType, UTTKind UKind, SourceLocation Loc)
Definition: SemaType.cpp:10119
DLLExportAttr * mergeDLLExportAttr(Decl *D, const AttributeCommonInfo &CI)
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ControllingExprOrType is either a TypeSourceInfo * or an Expr *.
Definition: SemaExpr.cpp:1743
ExprResult BuildCaptureInit(const sema::Capture &Capture, SourceLocation ImplicitCaptureLoc, bool IsOpenMPMapping=false)
Initialize the given capture with a suitable expression.
LazyDeclPtr StdBadAlloc
The C++ "std::bad_alloc" class, which is defined by the C++ standard library.
Definition: Sema.h:6645
void AddSYCLIntelBankWidthAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
void checkUnusedDeclAttributes(Declarator &D)
void ActOnPragmaClangSection(SourceLocation PragmaLoc, PragmaClangSectionAction Action, PragmaClangSectionKind SecKind, StringRef SecName)
ActOnPragmaClangSection - Called on well formed #pragma clang section.
Definition: SemaAttr.cpp:285
bool IsBlockPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType)
CastKind PrepareCastToObjCObjectPointer(ExprResult &E)
Prepare a conversion of the given expression to an ObjC object pointer type.
Definition: SemaExpr.cpp:7544
bool CheckFunctionTemplateSpecialization(FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs, LookupResult &Previous, bool QualifiedFriend=false)
Perform semantic analysis for the given function template specialization.
void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc, ArrayRef< Expr * > Args, AssociatedNamespaceSet &AssociatedNamespaces, AssociatedClassSet &AssociatedClasses)
Find the associated classes and namespaces for argument-dependent lookup for a call with the given se...
AssumedTemplateKind
Definition: Sema.h:9068
bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const FunctionProtoType *Target, bool SkipTargetFirstParameter, SourceLocation TargetLoc, const FunctionProtoType *Source, bool SkipSourceFirstParameter, SourceLocation SourceLoc)
CheckParamExceptionSpec - Check if the parameter and return types of the two functions have equivalen...
void AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, TemplateArgumentListInfo *ExplicitTemplateArgs, QualType ObjectType, Expr::Classification ObjectClassification, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, OverloadCandidateParamOrder PO={})
Add a C++ member function template as a candidate to the candidate set, using template argument deduc...
bool UnifySection(StringRef SectionName, int SectionFlags, NamedDecl *TheDecl)
Definition: SemaAttr.cpp:693
void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI, ParameterABI ABI)
void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld)
MergeVarDeclTypes - We parsed a variable 'New' which has the same name and scope as a previous declar...
Definition: SemaDecl.cpp:4502
void CodeCompleteInPreprocessorConditionalExclusion(Scope *S)
ExprResult ActOnUnevaluatedStringLiteral(ArrayRef< Token > StringToks)
Definition: SemaExpr.cpp:2041
QualType NSValuePointer
Pointer to NSValue type (NSValue *).
Definition: Sema.h:12392
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
Definition: SemaType.cpp:1979
void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr, SourceLocation OpLoc)
Warn if a value is moved to itself.
void CodeCompleteExpression(Scope *S, const CodeCompleteExpressionData &Data)
Perform code-completion in an expression context when we know what type we're looking for.
SYCLAddIRAttributesFunctionAttr * MergeSYCLAddIRAttributesFunctionAttr(Decl *D, const SYCLAddIRAttributesFunctionAttr &A)
bool InstantiateClassTemplateSpecialization(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK, bool Complain=true)
bool isSameOrCompatibleFunctionType(QualType Param, QualType Arg)
Compare types for equality with respect to possibly compatible function types (noreturn adjustment,...
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
Definition: SemaStmt.cpp:1246
AtomicArgumentOrder
Definition: Sema.h:1963
void PushFunctionScope()
Enter a new function scope.
Definition: Sema.cpp:2226
ExprResult ActOnNameClassifiedAsNonType(Scope *S, const CXXScopeSpec &SS, NamedDecl *Found, SourceLocation NameLoc, const Token &NextToken)
Act on the result of classifying a name as a specific non-type declaration.
Definition: SemaDecl.cpp:1268
bool RebuildNestedNameSpecifierInCurrentInstantiation(CXXScopeSpec &SS)
ExprResult ActOnBuiltinBitCastExpr(SourceLocation KWLoc, Declarator &Dcl, ExprResult Operand, SourceLocation RParenLoc)
Definition: SemaCast.cpp:385
void EmitCurrentDiagnostic(unsigned DiagID)
Cause the active diagnostic on the DiagosticsEngine to be emitted.
Definition: Sema.cpp:1566
SourceRange getExprRange(Expr *E) const
Definition: SemaExpr.cpp:586
bool ActOnCXXGlobalScopeSpecifier(SourceLocation CCLoc, CXXScopeSpec &SS)
The parser has parsed a global nested-name-specifier '::'.
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
NamedReturnInfo getNamedReturnInfo(Expr *&E, SimplerImplicitMoveMode Mode=SimplerImplicitMoveMode::Normal)
Determine whether the given expression might be move-eligible or copy-elidable in either a (co_)retur...
Definition: SemaStmt.cpp:3449
ExprResult CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection)
Definition: SemaStmt.cpp:2241
void setExceptionMode(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called to set exception behavior for floating point operations.
Definition: SemaAttr.cpp:1343
bool ActOnCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
The parser has parsed a nested-name-specifier 'identifier::'.
void PrintPragmaAttributeInstantiationPoint()
Definition: SemaAttr.cpp:1139
void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, OverloadCandidateParamOrder PO={}, bool AggregateCandidateDeduction=false)
Add a C++ function template specialization as a candidate in the candidate set, using template argume...
bool CheckFunctionReturnType(QualType T, SourceLocation Loc)
Definition: SemaType.cpp:2996
void CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, ObjCIvarDecl **Fields, unsigned nIvars, SourceLocation Loc)
CheckImplementationIvars - This routine checks if the instance variables listed in the implelementati...
void inferGslOwnerPointerAttribute(CXXRecordDecl *Record)
Add [[gsl::Owner]] and [[gsl::Pointer]] attributes for std:: types.
Definition: SemaAttr.cpp:167
std::unique_ptr< sema::FunctionScopeInfo, PoppedFunctionScopeDeleter > PoppedFunctionScopePtr
Definition: Sema.h:649
bool CheckMemberPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess)
CheckMemberPointerConversion - Check the member pointer conversion from the expression From to the ty...
void DefineImplicitCopyConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitCopyConstructor - Checks for feasibility of defining this constructor as the copy const...
LazyVector< const DeclaratorDecl *, ExternalSemaSource, &ExternalSemaSource::ReadUnusedFileScopedDecls, 2, 2 > UnusedFileScopedDeclsType
Definition: Sema.h:2630
static DeclarationName getPrintable(DeclarationName N)
Definition: Sema.h:11637
ObjCInterfaceDecl * getObjCInterfaceDecl(const IdentifierInfo *&Id, SourceLocation IdLoc, bool TypoCorrection=false)
Look for an Objective-C class in the translation unit.
Definition: SemaDecl.cpp:2326
llvm::function_ref< void(SourceLocation Loc, PartialDiagnostic PD)> DiagReceiverTy
Definition: Sema.h:3400
bool CheckEnumUnderlyingType(TypeSourceInfo *TI)
Check that this is a valid underlying type for an enum declaration.
Definition: SemaDecl.cpp:17125
bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id, bool IsUDSuffix)
bool FriendConstraintsDependOnEnclosingTemplate(const FunctionDecl *FD)
void DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID)
DiagnoseUnusedExprResult - If the statement passed in is an expression whose result is unused,...
Definition: SemaStmt.cpp:225
RecordDecl * StdSourceLocationImplDecl
The C++ "std::source_location::__impl" struct, defined in <source_location>.
Definition: Sema.h:6604
Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, TranslationUnitKind TUKind=TU_Complete, CodeCompleteConsumer *CompletionConsumer=nullptr)
Definition: Sema.cpp:194
void SetLateTemplateParser(LateTemplateParserCB *LTP, LateTemplateParserCleanupCB *LTPCleanup, void *P)
Definition: Sema.h:908
ConditionResult ActOnCondition(Scope *S, SourceLocation Loc, Expr *SubExpr, ConditionKind CK, bool MissingOK=false)
Definition: SemaExpr.cpp:20736
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
Definition: Sema.cpp:63
sema::LambdaScopeInfo * PushLambdaScope()
Definition: Sema.cpp:2244
StmtResult ActOnCoreturnStmt(Scope *S, SourceLocation KwLoc, Expr *E)
void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr)
void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
void PopCompoundScope()
Definition: Sema.cpp:2383
bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:11918
bool EnsureTemplateArgumentListConstraints(TemplateDecl *Template, const MultiLevelTemplateArgumentList &TemplateArgs, SourceRange TemplateIDRange)
Ensure that the given template arguments satisfy the constraints associated with the given template,...
bool isObjCMethodDecl(Decl *D)
Definition: Sema.h:12220
void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext, bool IsUsingDeclaration, QualType BaseType, QualType PreferredType)
SkipBodyInfo shouldSkipAnonEnumBody(Scope *S, IdentifierInfo *II, SourceLocation IILoc)
Determine whether the body of an anonymous enumeration should be skipped.
Definition: SemaDecl.cpp:20151
UnexpandedParameterPackContext
The context in which an unexpanded parameter pack is being diagnosed.
Definition: Sema.h:10982
@ UPPC_FixedUnderlyingType
The fixed underlying type of an enumeration.
Definition: Sema.h:11002
@ UPPC_RequiresClause
Definition: Sema.h:11053
@ UPPC_UsingDeclaration
A using declaration.
Definition: Sema.h:11008
@ UPPC_IfExists
Microsoft __if_exists.
Definition: Sema.h:11035
@ UPPC_Requirement
Definition: Sema.h:11050
@ UPPC_ExceptionType
The type of an exception.
Definition: Sema.h:11026
@ UPPC_EnumeratorValue
The enumerator value.
Definition: Sema.h:11005
@ UPPC_Lambda
Lambda expression.
Definition: Sema.h:11041
@ UPPC_IfNotExists
Microsoft __if_not_exists.
Definition: Sema.h:11038
@ UPPC_PartialSpecialization
Partial specialization.
Definition: Sema.h:11032
@ UPPC_Initializer
An initializer.
Definition: Sema.h:11017
@ UPPC_BaseType
The base type of a class type.
Definition: Sema.h:10987
@ UPPC_FriendDeclaration
A friend declaration.
Definition: Sema.h:11011
@ UPPC_DefaultArgument
A default argument.
Definition: Sema.h:11020
@ UPPC_DeclarationType
The type of an arbitrary declaration.
Definition: Sema.h:10990
@ UPPC_Expression
An arbitrary expression.
Definition: Sema.h:10984
@ UPPC_ExplicitSpecialization
Explicit specialization.
Definition: Sema.h:11029
@ UPPC_DeclarationQualifier
A declaration qualifier.
Definition: Sema.h:11014
@ UPPC_DataMemberType
The type of a data member.
Definition: Sema.h:10993
@ UPPC_StaticAssertExpression
The expression in a static assertion.
Definition: Sema.h:10999
@ UPPC_Block
Block expression.
Definition: Sema.h:11044
@ UPPC_BitFieldWidth
The size of a bit-field.
Definition: Sema.h:10996
@ UPPC_NonTypeTemplateParameterType
The type of a non-type template parameter.
Definition: Sema.h:11023
@ UPPC_TypeConstraint
A type constraint.
Definition: Sema.h:11047
CodeSegAttr * mergeCodeSegAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Name)
ObjCMethodDecl * ValueWithBytesObjCTypeMethod
The declaration of the valueWithBytes:objCType: method.
Definition: Sema.h:12407
void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, const IdentifierInfo *ClassName, SmallVectorImpl< Decl * > &Decls)
Called whenever @defs(ClassName) is encountered in the source.
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
Definition: SemaStmt.cpp:4322
void AddAnyMethodToGlobalPool(Decl *D)
AddAnyMethodToGlobalPool - Add any method, instance or factory to global pool.
api_notes::APINotesManager APINotes
Definition: Sema.h:863
bool checkNSReturnsRetainedReturnType(SourceLocation loc, QualType type)
CXXConstructorDecl * LookupDefaultConstructor(CXXRecordDecl *Class)
Look up the default constructor for the given class.
bool IsLayoutCompatible(QualType T1, QualType T2) const
Decl * ActOnStartNamespaceDef(Scope *S, SourceLocation InlineLoc, SourceLocation NamespaceLoc, SourceLocation IdentLoc, IdentifierInfo *Ident, SourceLocation LBrace, const ParsedAttributesView &AttrList, UsingDirectiveDecl *&UsingDecl, bool IsNested)
ActOnStartNamespaceDef - This is called at the start of a namespace definition.
llvm::DenseMap< Decl *, SmallVector< PartialDiagnosticAt, 1 > > SuppressedDiagnosticsMap
For each declaration that involved template argument deduction, the set of diagnostics that were supp...
Definition: Sema.h:9763
void buildLambdaScope(sema::LambdaScopeInfo *LSI, CXXMethodDecl *CallOperator, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, bool ExplicitParams, bool Mutable)
Endow the lambda scope info with the relevant properties.
Definition: SemaLambda.cpp:482
void DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl, bool SupportedForCompatibility=false)
DiagnoseTemplateParameterShadow - Produce a diagnostic complaining that the template parameter 'PrevD...
TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr, bool RecordFailure=true)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
RecordDecl * CFError
The struct behind the CFErrorRef pointer.
Definition: Sema.h:11790
QualType CheckComparisonCategoryType(ComparisonCategoryType Kind, SourceLocation Loc, ComparisonCategoryUsage Usage)
Lookup the specified comparison category types in the standard library, an check the VarDecls possibl...
void DiagnoseTypeArgsAndProtocols(IdentifierInfo *ProtocolId, SourceLocation ProtocolLoc, IdentifierInfo *TypeArgId, SourceLocation TypeArgLoc, bool SelectProtocolFirst=false)
void PopParsingDeclaration(ParsingDeclState state, Decl *decl)
bool RequireCompleteExprType(Expr *E, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type of the given expression is complete.
Definition: SemaType.cpp:9338
bool RebuildTemplateParamsInCurrentInstantiation(TemplateParameterList *Params)
Rebuild the template parameters now that we know we're in a current instantiation.
void AddSYCLReqdWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI, Expr *XDim, Expr *YDim, Expr *ZDim)
void DiagnoseInvalidJumps(Stmt *Body)
void CheckDeprecatedSYCLAttributeSpelling(const ParsedAttr &A, StringRef NewName="")
Diagnoses an attribute in the 'intelfpga' namespace and suggests using the attribute in the 'intel' n...
bool ProcessAccessDeclAttributeList(AccessSpecDecl *ASDecl, const ParsedAttributesView &AttrList)
bool CaptureHasSideEffects(const sema::Capture &From)
Does copying/destroying the captured variable have side effects?
void DiagnoseAbsenceOfOverrideControl(NamedDecl *D, bool Inconsistent)
DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was not used in the declaration of ...
StmtResult ActOnFinishFullStmt(Stmt *Stmt)
ObjCProtocolDecl * ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc, Decl *const *ProtoRefNames, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody)
void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D)
SmallVector< VTableUse, 16 > VTableUses
The list of vtables that are required but have not yet been materialized.
Definition: Sema.h:4542
TypoExpr * CorrectTypoDelayed(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, TypoDiagnosticGenerator TDG, TypoRecoveryCallback TRC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
AccessResult CheckStructuredBindingMemberAccess(SourceLocation UseLoc, CXXRecordDecl *DecomposedClass, DeclAccessPair Field)
Checks implicit access to a member in a structured binding.
void LookupVisibleDecls(Scope *S, LookupNameKind Kind, VisibleDeclConsumer &Consumer, bool IncludeGlobalScope=true, bool LoadExternal=true)
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
Definition: SemaStmt.cpp:1720
QualType CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
Definition: SemaExpr.cpp:12596
SourceLocation CurInitSegLoc
Definition: Sema.h:1453
CastKind PrepareScalarCast(ExprResult &src, QualType destType)
Prepares for a scalar cast, performing all the necessary stages except the final cast and returning t...
Definition: SemaExpr.cpp:7559
QualType CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
Definition: SemaExpr.cpp:13372
void CheckObjCPropertyAttributes(Decl *PropertyPtrTy, SourceLocation Loc, unsigned &Attributes, bool propertyInPrimaryClass)
Ensure attributes are consistent with type.
SYCLIntelPipeIOAttr * MergeSYCLIntelPipeIOAttr(Decl *D, const SYCLIntelPipeIOAttr &A)
void ActOnPragmaMSVtorDisp(PragmaMsStackAction Action, SourceLocation PragmaLoc, MSVtorDispMode Value)
Called on well formed #pragma vtordisp().
Definition: SemaAttr.cpp:622
bool currentModuleIsHeaderUnit() const
Is the module scope we are in a C++ Header Unit?
Definition: Sema.h:2651
void ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, Declarator &ParamInfo, const DeclSpec &DS)
ActOnStartOfLambdaDefinition - This is called just before we start parsing the body of a lambda; it a...
void SwapSatisfactionStack(llvm::SmallVectorImpl< SatisfactionStackEntryTy > &NewSS)
Definition: Sema.h:11411
void EnterTemplatedContext(Scope *S, DeclContext *DC)
Enter a template parameter scope, after it's been associated with a particular DeclContext.
Definition: SemaDecl.cpp:1412
void CheckAlignasUnderalignment(Decl *D)
ReuseLambdaContextDecl_t
Definition: Sema.h:5402
@ ReuseLambdaContextDecl
Definition: Sema.h:5402
void ActOnBaseSpecifiers(Decl *ClassDecl, MutableArrayRef< CXXBaseSpecifier * > Bases)
ActOnBaseSpecifiers - Attach the given base specifiers to the class, after checking whether there are...
bool tryToFixVariablyModifiedVarType(TypeSourceInfo *&TInfo, QualType &T, SourceLocation Loc, unsigned FailedFoldDiagID)
Attempt to fold a variable-sized type to a constant-sized type, returning true if we were successful.
Definition: SemaDecl.cpp:6776
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
ExprResult ActOnNoexceptSpec(Expr *NoexceptExpr, ExceptionSpecificationType &EST)
Check the given noexcept-specifier, convert its expression, and compute the appropriate ExceptionSpec...
void ProcessDeclAttributeList(Scope *S, Decl *D, const ParsedAttributesView &AttrList, const ProcessDeclAttributeOptions &Options=ProcessDeclAttributeOptions())
void MarkExpressionAsImmediateEscalating(Expr *E)
Definition: SemaExpr.cpp:17840
void NoteTemplateLocation(const NamedDecl &Decl, std::optional< SourceRange > ParamRange={})
NamedDecl * findLocallyScopedExternCDecl(DeclarationName Name)
Look for a locally scoped extern "C" declaration by the given name.
Definition: SemaDecl.cpp:6814
bool CheckRedeclarationModuleOwnership(NamedDecl *New, NamedDecl *Old)
We've determined that New is a redeclaration of Old.
Definition: SemaDecl.cpp:1627
void ActOnLambdaClosureParameters(Scope *LambdaScope, MutableArrayRef< DeclaratorChunk::ParamInfo > ParamInfo)
void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange)
CheckCastAlign - Implements -Wcast-align, which warns when a pointer cast increases the alignment req...
NonOdrUseReason getNonOdrUseReasonInCurrentContext(ValueDecl *D)
If D cannot be odr-used in the current expression evaluation context, return a reason explaining why.
Definition: SemaExpr.cpp:2322
void DefineDefaultedComparison(SourceLocation Loc, FunctionDecl *FD, DefaultedComparisonKind DCK)
bool isUnexpandedParameterPackPermitted()
Determine whether an unexpanded parameter pack might be permitted in this location.
bool isEquivalentInternalLinkageDeclaration(const NamedDecl *A, const NamedDecl *B)
Determine if A and B are equivalent internal linkage declarations from different modules,...
void diagnoseUnavailableAlignedAllocation(const FunctionDecl &FD, SourceLocation Loc)
Produce diagnostics if FD is an aligned allocation or deallocation function that is unavailable.
void MarkFunctionParmPackReferenced(FunctionParmPackExpr *E)
Perform reference-marking and odr-use handling for a FunctionParmPackExpr.
Definition: SemaExpr.cpp:20367
void * OpaqueParser
Definition: Sema.h:906
Preprocessor & PP
Definition: Sema.h:858
QualType CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, QualType *CompLHSTy=nullptr)
Definition: SemaExpr.cpp:11377
VariadicCallType getVariadicCallType(FunctionDecl *FDecl, const FunctionProtoType *Proto, Expr *Fn)
Definition: SemaExpr.cpp:5972
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, std::optional< unsigned > NumExpansions)
bool CheckConstexprFunctionDefinition(const FunctionDecl *FD, CheckConstexprKind Kind)
void CodeCompleteObjCImplementationDecl(Scope *S)
bool isPotentialImplicitMemberAccess(const CXXScopeSpec &SS, LookupResult &R, bool IsAddressOfOperand)
Check whether an expression might be an implicit class member access.
ExprResult BuildCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false, bool AllowRecovery=false)
BuildCallExpr - Handle a call to Fn with the specified array of arguments.
Definition: SemaExpr.cpp:6717
ExprResult BuildSynthesizedThreeWayComparison(SourceLocation OpLoc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, FunctionDecl *DefaultedFn)
QualType BuiltinEnumUnderlyingType(QualType BaseType, SourceLocation Loc)
Definition: SemaType.cpp:10044
AccessResult CheckBaseClassAccess(SourceLocation AccessLoc, QualType Base, QualType Derived, const CXXBasePath &Path, unsigned DiagID, bool ForceCheck=false, bool ForceUnprivileged=false)
Checks access for a hierarchy conversion.
bool CheckUseOfCXXMethodAsAddressOfOperand(SourceLocation OpLoc, const Expr *Op, const CXXMethodDecl *MD)
Definition: SemaExpr.cpp:14521
bool MSPragmaOptimizeIsOn
The "on" or "off" argument passed by #pragma optimize, that denotes whether the optimizations in the ...
Definition: Sema.h:1500
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
ExprResult BuildSourceLocExpr(SourceLocIdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
Definition: SemaExpr.cpp:17109
bool ActOnAlignasTypeArgument(StringRef KWName, ParsedType Ty, SourceLocation OpLoc, SourceRange R)
ActOnAlignasTypeArgument - Handle alignas(type-id) and _Alignas(type-name) .
Definition: SemaExpr.cpp:5016
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
ExprResult checkPseudoObjectIncDec(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opcode, Expr *Op)
Check an increment or decrement of a pseudo-object expression.
threadSafety::BeforeSet * ThreadSafetyDeclCache
Definition: Sema.h:899
SmallVector< PragmaAttributeGroup, 2 > PragmaAttributeStack
Definition: Sema.h:1478
NamedDecl * getShadowedDeclaration(const TypedefNameDecl *D, const LookupResult &R)
Return the declaration shadowed by the given typedef D, or null if it doesn't shadow any declaration ...
Definition: SemaDecl.cpp:8443
void checkTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D=nullptr)
Check if the type is allowed to be used for the current target.
Definition: Sema.cpp:2014
AccessResult CheckUnresolvedMemberAccess(UnresolvedMemberExpr *E, DeclAccessPair FoundDecl)
Perform access-control checking on a previously-unresolved member access which has now been resolved ...
bool hasVisibleMemberSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is a member specialization declaration (as oppo...
void updateOutOfDateSelector(Selector Sel)
bool areMatrixTypesOfTheSameDimension(QualType srcTy, QualType destTy)
Are the two types matrix types and do they have the same dimensions i.e.
Definition: SemaExpr.cpp:7829
void AddSYCLAddIRAnnotationsMemberAttr(Decl *D, const AttributeCommonInfo &CI, MutableArrayRef< Expr * > Args)
void DiagnoseInvalidExplicitObjectParameterInLambda(CXXMethodDecl *Method)
Definition: SemaLambda.cpp:391
void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
AddBuiltinOperatorCandidates - Add the appropriate built-in operator overloads to the candidate set (...
ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnCXXBoolLiteral - Parse {true,false} literals.
LazyVector< VarDecl *, ExternalSemaSource, &ExternalSemaSource::ReadTentativeDefinitions, 2, 2 > TentativeDefinitionsType
Definition: Sema.h:2638
void AtomicPropertySetterGetterRules(ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl)
AtomicPropertySetterGetterRules - This routine enforces the rule (via warning) when atomic property h...
ObjCMethodDecl * NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]
The Objective-C NSNumber methods used to create NSNumber literals.
Definition: Sema.h:12395
llvm::SmallSetVector< const NamedDecl *, 16 > NamedDeclSetType
Definition: Sema.h:4963
void CheckExtraCXXDefaultArguments(Declarator &D)
CheckExtraCXXDefaultArguments - Check for any extra default arguments in the declarator,...
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
void CheckCompleteDecompositionDeclaration(DecompositionDecl *DD)
void CodeCompleteObjCPropertySetter(Scope *S)
bool CheckRegparmAttr(const ParsedAttr &attr, unsigned &value)
void AddSYCLIntelPrivateCopiesAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
bool hasCStrMethod(const Expr *E)
Check to see if a given expression could have '.c_str()' called on it.
ObjCSubscriptKind CheckSubscriptingKind(Expr *FromE)
CheckSubscriptingKind - This routine decide what type of indexing represented by "FromE" is being don...
void checkClassLevelDLLAttribute(CXXRecordDecl *Class)
Check class-level dllimport/dllexport attribute.
bool CheckConstraintSatisfaction(const NamedDecl *Template, ArrayRef< const Expr * > ConstraintExprs, const MultiLevelTemplateArgumentList &TemplateArgLists, SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction)
Check whether the given list of constraint expressions are satisfied (as if in a 'conjunction') given...
Definition: Sema.h:11439
DeviceDiagnosticReason getEmissionReason(const FunctionDecl *Decl)
Definition: SemaDecl.cpp:20764
const LangOptions & LangOpts
Definition: Sema.h:857
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
Definition: SemaStmt.cpp:3113
void InstantiateClassMembers(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiates the definitions of all of the member of the given class, which is an instantiation of a ...
void EmitRelatedResultTypeNoteForReturn(QualType destType)
Given that we had incompatible pointer types in a return statement, check whether we're in a method w...
void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
ActOnCXXExitDeclaratorScope - Called when a declarator that previously invoked ActOnCXXEnterDeclarato...
void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation)
SetIvarInitializers - This routine builds initialization ASTs for the Objective-C implementation whos...
std::pair< Expr *, std::string > findFailedBooleanCondition(Expr *Cond)
Find the failed Boolean condition within a given Boolean constant expression, and describe it with a ...
bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, AllocationFunctionScope NewScope, AllocationFunctionScope DeleteScope, QualType AllocType, bool IsArray, bool &PassAlignment, MultiExprArg PlaceArgs, FunctionDecl *&OperatorNew, FunctionDecl *&OperatorDelete, bool Diagnose=true)
Finds the overloads of operator new and delete that are appropriate for the allocation.
ExprResult PerformQualificationConversion(Expr *E, QualType Ty, ExprValueKind VK=VK_PRValue, CheckedConversionKind CCK=CheckedConversionKind::Implicit)
Definition: SemaInit.cpp:8573
void DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock)
void MarkVirtualMembersReferenced(SourceLocation Loc, const CXXRecordDecl *RD, bool ConstexprOnly=false)
MarkVirtualMembersReferenced - Will mark all members of the given CXXRecordDecl referenced.
bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType, bool InOverloadResolution, QualType &ConvertedType)
IsMemberPointerConversion - Determines whether the conversion of the expression From,...
const LangOptions & getLangOpts() const
Definition: Sema.h:521
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
Definition: SemaExpr.cpp:16252
std::unique_ptr< sema::FunctionScopeInfo > CachedFunctionScope
Definition: Sema.h:804
ExprResult CorrectDelayedTyposInExpr(ExprResult ER, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult { return E;})
Definition: Sema.h:7029
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
Definition: Sema.cpp:2460
ExprResult BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc, ArrayRef< Expr * > Arg, SourceLocation RParenLoc, Expr *Config=nullptr, bool IsExecConfig=false, ADLCallKind UsesADL=ADLCallKind::NotADL)
BuildResolvedCallExpr - Build a call to a resolved expression, i.e.
Definition: SemaExpr.cpp:6985
static const uint64_t MaximumAlignment
Definition: Sema.h:799
void CodeCompleteFunctionQualifiers(DeclSpec &DS, Declarator &D, const VirtSpecifiers *VS=nullptr)
void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddInstanceMethodToGlobalPool - All instance methods in a translation unit are added to a global pool...
Definition: Sema.h:12345
ExprResult BuildCXXMemberCallExpr(Expr *Exp, NamedDecl *FoundDecl, CXXConversionDecl *Method, bool HadMultipleCandidates)
void CheckSYCLAddIRAttributesFunctionAttrConflicts(Decl *D)
llvm::DenseMap< unsigned, CXXDeductionGuideDecl * > AggregateDeductionCandidates
Definition: Sema.h:7231
ExprResult CheckConditionVariable(VarDecl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
Check the use of the given variable as a C++ condition in an if, while, do-while, or switch statement...
ExprResult CheckForImmediateInvocation(ExprResult E, FunctionDecl *Decl)
Wrap the expression in a ConstantExpr if it is a potential immediate invocation.
Definition: SemaExpr.cpp:17861
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
Definition: SemaInit.cpp:8555
bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList)
void ActOnStartOfCompoundStmt(bool IsStmtExpr)
Definition: SemaStmt.cpp:395
bool isReachable(const NamedDecl *D)
Determine whether a declaration is reachable.
Definition: Sema.h:11931
void PerformPendingInstantiations(bool LocalOnly=false)
Performs template instantiation for all implicit template instantiations we have seen until this poin...
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists, SkipBodyInfo *SkipBody=nullptr, FnBodyKind BodyKind=FnBodyKind::Other)
Definition: SemaDecl.cpp:15600
NamedDeclSetType UnusedPrivateFields
Set containing all declared private fields that are not used.
Definition: Sema.h:4965
Expr * stripARCUnbridgedCast(Expr *e)
stripARCUnbridgedCast - Given an expression of ARCUnbridgedCast type, remove the placeholder cast.
VarTemplateSpecializationDecl * CompleteVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiates a variable template specialization by completing it with appropriate type information an...
llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate > > LateParsedTemplateMapT
Definition: Sema.h:9017
void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver, ArrayRef< const IdentifierInfo * > SelIdents, bool AtArgumentExpression, ObjCInterfaceDecl *Super=nullptr)
bool CollectStats
Flag indicating whether or not to collect detailed statistics.
Definition: Sema.h:802
llvm::SmallSetVector< DeclContext *, 16 > AssociatedNamespaceSet
Definition: Sema.h:7537
bool DiagnoseUnusedLambdaCapture(SourceRange CaptureRange, const sema::Capture &From)
Diagnose if an explicit lambda capture is unused.
void DefineInheritingConstructor(SourceLocation UseLoc, CXXConstructorDecl *Constructor)
Define the specified inheriting constructor.
ExprResult ConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
ConvertVectorExpr - Handle __builtin_convertvector.
void ActOnEndOfTranslationUnitFragment(TUFragmentKind Kind)
Definition: Sema.cpp:1079
bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const
Definition: SemaDecl.cpp:1884
bool CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, LookupResult &Previous, bool IsMemberSpecialization, bool DeclIsDefn)
Perform semantic checking of a new function declaration.
Definition: SemaDecl.cpp:12145
CXXRecordDecl * getStdBadAlloc() const
ExprResult ActOnCXXTypeConstructExpr(ParsedType TypeRep, SourceLocation LParenOrBraceLoc, MultiExprArg Exprs, SourceLocation RParenOrBraceLoc, bool ListInitialization)
ActOnCXXTypeConstructExpr - Parse construction of a specified type.
FieldDecl * CheckFieldDecl(DeclarationName Name, QualType T, TypeSourceInfo *TInfo, RecordDecl *Record, SourceLocation Loc, bool Mutable, Expr *BitfieldWidth, InClassInitStyle InitStyle, SourceLocation TSSL, AccessSpecifier AS, NamedDecl *PrevDecl, Declarator *D=nullptr)
Build a new FieldDecl and check its well-formedness.
Definition: SemaDecl.cpp:18796
void CheckUnusedVolatileAssignment(Expr *E)
Check whether E, which is either a discarded-value expression or an unevaluated operand,...
Definition: SemaExpr.cpp:17825
ObjCLiteralKind
Definition: Sema.h:5889
@ LK_Boxed
Definition: Sema.h:5893
@ LK_Dictionary
Definition: Sema.h:5891
@ LK_String
Definition: Sema.h:5894
@ LK_Array
Definition: Sema.h:5890
@ LK_Numeric
Definition: Sema.h:5892
@ LK_None
Definition: Sema.h:5896
@ LK_Block
Definition: Sema.h:5895
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
void updateAttrsForLateParsedTemplate(const Decl *Pattern, Decl *Inst)
Update instantiation attributes after template was late parsed.
QualType CheckDestructorDeclarator(Declarator &D, QualType R, StorageClass &SC)
CheckDestructorDeclarator - Called by ActOnDeclarator to check the well-formednes of the destructor d...
bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange)
Mark the given method pure.
void SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg, SourceLocation EqualLoc)
PragmaClangSection PragmaClangRelroSection
Definition: Sema.h:1190
void NoteHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
IdentifierInfo * InventAbbreviatedTemplateParameterTypeName(const IdentifierInfo *ParamName, unsigned Index)
Invent a new identifier for parameters of abbreviated templates.
Definition: Sema.cpp:97
void InstantiateVariableInitializer(VarDecl *Var, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the initializer of a variable.
CXXMethodDecl * DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit move assignment operator for the given class.
bool IsSimplyAccessible(NamedDecl *Decl, CXXRecordDecl *NamingClass, QualType BaseType)
Checks access to Target from the given class.
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc, TypeSourceInfo **TSI, bool DeducedTSTContext)
bool checkConstantPointerAuthKey(Expr *keyExpr, unsigned &key)
SourceLocation ImplicitMSInheritanceAttrLoc
Source location for newly created implicit MSInheritanceAttrs.
Definition: Sema.h:1167
llvm::DenseMap< CXXRecordDecl *, bool > VTablesUsed
The set of classes whose vtables have been used within this translation unit, and a bit that will be ...
Definition: Sema.h:4548
bool DeduceFunctionTypeFromReturnExpr(FunctionDecl *FD, SourceLocation ReturnLoc, Expr *RetExpr, const AutoType *AT)
Deduce the return type for a function from a returned expression, per C++1y [dcl.spec....
Definition: SemaStmt.cpp:3865
void AddSYCLIntelNumBanksAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
EnforceTCBAttr * mergeEnforceTCBAttr(Decl *D, const EnforceTCBAttr &AL)
QualType buildLambdaInitCaptureInitialization(SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc, std::optional< unsigned > NumExpansions, IdentifierInfo *Id, bool DirectInit, Expr *&Init)
Definition: SemaLambda.cpp:743
void MaybeSuggestAddingStaticToDecl(const FunctionDecl *D)
Definition: SemaExpr.cpp:204
SYCLIntelMaxReinvocationDelayAttr * BuildSYCLIntelMaxReinvocationDelayAttr(const AttributeCommonInfo &CI, Expr *E)
void CheckCXXDefaultArguments(FunctionDecl *FD)
Helpers for dealing with blocks and functions.
ComparisonCategoryUsage
Definition: Sema.h:4042
SmallVector< PendingImplicitInstantiation, 1 > LateParsedInstantiations
Queue of implicit template instantiations that cannot be performed eagerly.
Definition: Sema.h:10710
SmallVector< InventedTemplateParameterInfo, 4 > InventedParameterInfos
Stack containing information needed when in C++2a an 'auto' is encountered in a function declaration ...
Definition: Sema.h:4958
DeclarationNameInfo SubstDeclarationNameInfo(const DeclarationNameInfo &NameInfo, const MultiLevelTemplateArgumentList &TemplateArgs)
Do template substitution on declaration name info.
bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid)
Determine whether the use of this declaration is valid, without emitting diagnostics.
Definition: SemaExpr.cpp:71
ConditionResult ActOnConditionVariable(Decl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
ObjCInterfaceDecl * NSNumberDecl
The declaration of the Objective-C NSNumber class.
Definition: Sema.h:12383
bool checkUnsafeAssigns(SourceLocation Loc, QualType LHS, Expr *RHS)
checkUnsafeAssigns - Check whether +1 expr is being assigned to weak/__unsafe_unretained type.
void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse)
Perform marking for a reference to an arbitrary declaration.
Definition: SemaExpr.cpp:20377
void MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class, bool DefinitionRequired=false)
Note that the vtable for the given class was used at the given location.
bool CheckAllocatedType(QualType AllocType, SourceLocation Loc, SourceRange R)
Checks that a type is suitable as the allocated type in a new-expression.
QualType InvalidLogicalVectorOperands(SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
Definition: SemaExpr.cpp:10317
bool diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND, SourceLocation Loc)
Emit diagnostics for the diagnose_if attributes on Function, ignoring any ArgDependent DiagnoseIfAttr...
static StringRef getPrintable(StringRef S)
Definition: Sema.h:11632
const ExpressionEvaluationContextRecord & currentEvaluationContext() const
Definition: Sema.h:5339
NamedDecl * BuildUsingEnumDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, SourceLocation EnumLoc, SourceLocation NameLoc, TypeSourceInfo *EnumType, EnumDecl *ED)
void AddImplicitMSFunctionNoBuiltinAttr(FunctionDecl *FD)
Only called on function definitions; if there is a pragma in scope with the effect of a range-based n...
Definition: SemaAttr.cpp:1221
TypeLoc getReturnTypeLoc(FunctionDecl *FD) const
Definition: SemaStmt.cpp:3856
PragmaStack< AlignPackInfo > AlignPackStack
Definition: Sema.h:1402
CUDALaunchBoundsAttr * CreateLaunchBoundsAttr(const AttributeCommonInfo &CI, Expr *MaxThreads, Expr *MinBlocks, Expr *MaxBlocks)
Create an CUDALaunchBoundsAttr attribute.
ExprResult BuildInstanceMessageImplicit(Expr *Receiver, QualType ReceiverType, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
bool canDelayFunctionBody(const Declarator &D)
Determine whether we can delay parsing the body of a function or function template until it is used,...
Definition: SemaDecl.cpp:16073
SmallVector< std::pair< const CXXMethodDecl *, const CXXMethodDecl * >, 2 > DelayedOverridingExceptionSpecChecks
All the overriding functions seen during a class definition that had their exception spec checks dela...
Definition: Sema.h:5057
static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx)
CleanupInfo Cleanup
Used to control the generation of ExprWithCleanups.
Definition: Sema.h:5357
std::vector< std::unique_ptr< TemplateInstantiationCallback > > TemplateInstCallbacks
The template instantiation callbacks to trace or track instantiations (objects can be chained).
Definition: Sema.h:10484
llvm::DenseMap< ParmVarDecl *, SourceLocation > UnparsedDefaultArgLocs
Definition: Sema.h:4991
void CodeCompleteNamespaceDecl(Scope *S)
StmtResult ActOnExprStmtError()
Definition: SemaStmt.cpp:69
AcceptableKind
Definition: Sema.h:7533
PragmaStack< StringLiteral * > BSSSegStack
Definition: Sema.h:1412
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
const VarDecl * getCopyElisionCandidate(NamedReturnInfo &Info, QualType ReturnType)
Updates given NamedReturnInfo's move-eligible and copy-elidable statuses, considering the function re...
Definition: SemaStmt.cpp:3544
SYCLAddIRAnnotationsMemberAttr * MergeSYCLAddIRAnnotationsMemberAttr(Decl *D, const SYCLAddIRAnnotationsMemberAttr &A)
void CodeCompleteDesignator(const QualType BaseType, llvm::ArrayRef< Expr * > InitExprs, const Designation &D)
Trigger code completion for a record of BaseType.
void AddSYCLIntelSchedulerTargetFmaxMhzAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
void MarkVirtualMemberExceptionSpecsNeeded(SourceLocation Loc, const CXXRecordDecl *RD)
Mark the exception specifications of all virtual member functions in the given class as needed.
EnforceTCBLeafAttr * mergeEnforceTCBLeafAttr(Decl *D, const EnforceTCBLeafAttr &AL)
const ObjCMethodDecl * SelectorsForTypoCorrection(Selector Sel, QualType ObjectType=QualType())
bool hasAnyAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates=true, bool AllowDependent=true, bool AllowNonTemplateFunctions=false)
static const std::string & getPrintable(const std::string &S)
Definition: Sema.h:11633
void completeExprArrayBound(Expr *E)
Definition: SemaType.cpp:9265
std::function< TypeResult(StringRef, StringRef, SourceLocation)> ParseTypeFromStringCallback
Callback to the parser to parse a type expressed as a string.
Definition: Sema.h:917
ExprResult BuildConvertedConstantExpression(Expr *From, QualType T, CCEKind CCE, NamedDecl *Dest=nullptr)
llvm::StringMap< std::tuple< StringRef, SourceLocation > > FunctionToSectionMap
Sections used with #pragma alloc_text.
Definition: Sema.h:1456
bool ActOnSuperScopeSpecifier(SourceLocation SuperLoc, SourceLocation ColonColonLoc, CXXScopeSpec &SS)
The parser has parsed a '__super' nested-name-specifier.
bool CheckDependentFunctionTemplateSpecialization(FunctionDecl *FD, const TemplateArgumentListInfo *ExplicitTemplateArgs, LookupResult &Previous)
Perform semantic analysis for the given dependent function template specialization.
NamedDecl * getCurFunctionOrMethodDecl() const
getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method or C function we're in,...
Definition: Sema.cpp:1553
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, const CXXScopeSpec &SS, QualType T, TagDecl *OwnedTagDecl=nullptr)
Retrieve a version of the type 'T' that is elaborated by Keyword, qualified by the nested-name-specif...
Definition: SemaType.cpp:9853
bool RequireCompleteEnumDecl(EnumDecl *D, SourceLocation L, CXXScopeSpec *SS=nullptr)
Require that the EnumDecl is completed with its enumerators defined or instantiated.
ExprResult ActOnRequiresExpr(SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, SourceLocation LParenLoc, ArrayRef< ParmVarDecl * > LocalParameters, SourceLocation RParenLoc, ArrayRef< concepts::Requirement * > Requirements, SourceLocation ClosingBraceLoc)
OverloadKind CheckOverload(Scope *S, FunctionDecl *New, const LookupResult &OldDecls, NamedDecl *&OldDecl, bool UseMemberUsingDeclRules)
Determine whether the given New declaration is an overload of the declarations in Old.
bool CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl)
CheckOverloadedOperatorDeclaration - Check whether the declaration of this overloaded operator is wel...
bool hasExplicitCallingConv(QualType T)
Definition: SemaType.cpp:8437
NameClassification ClassifyName(Scope *S, CXXScopeSpec &SS, IdentifierInfo *&Name, SourceLocation NameLoc, const Token &NextToken, CorrectionCandidateCallback *CCC=nullptr)
Perform name lookup on the given name, classifying it based on the results of name lookup and the fol...
Definition: SemaDecl.cpp:880
void PrintInstantiationStack()
Prints the current instantiation stack through a series of notes.
AMDGPUWavesPerEUAttr * CreateAMDGPUWavesPerEUAttr(const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
Create an AMDGPUWavesPerEUAttr attribute.
QualType NSStringPointer
Pointer to NSString type (NSString *).
Definition: Sema.h:12401
StmtResult ActOnNullStmt(SourceLocation SemiLoc, bool HasLeadingEmptyMacro=false)
Definition: SemaStmt.cpp:74
OpenCLOptions OpenCLFeatures
Definition: Sema.h:854
QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, bool ConvertArgs=true)
Find a merged pointer type and convert the two expressions to it.
IntelReqdSubGroupSizeAttr * MergeIntelReqdSubGroupSizeAttr(Decl *D, const IntelReqdSubGroupSizeAttr &A)
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
SmallVector< std::deque< PendingImplicitInstantiation >, 8 > SavedPendingInstantiations
Definition: Sema.h:10714
bool checkTargetVersionAttr(SourceLocation LiteralLoc, Decl *D, StringRef &Str, bool &isDefault)
VarArgKind isValidVarArgType(const QualType &Ty)
Determine the degree of POD-ness for an expression.
Definition: SemaExpr.cpp:1012
NonTagKind getNonTagTypeDeclKind(const Decl *D, TagTypeKind TTK)
Given a non-tag type declaration, returns an enum useful for indicating what kind of non-tag type thi...
Definition: SemaDecl.cpp:17203
SYCLIntelMaxInterleavingAttr * BuildSYCLIntelMaxInterleavingAttr(const AttributeCommonInfo &CI, Expr *E)
SYCLIntelIVDepAttr * BuildSYCLIntelIVDepAttr(const AttributeCommonInfo &CI, Expr *Expr1, Expr *Expr2)
llvm::SmallSetVector< StringRef, 4 > MSFunctionNoBuiltins
Set of no-builtin functions listed by #pragma function.
Definition: Sema.h:1503
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
void ExitDeclaratorContext(Scope *S)
Definition: SemaDecl.cpp:1399
bool isQualifiedMemberAccess(Expr *E)
Determine whether the given expression is a qualified member access expression, of a form that could ...
Definition: SemaExpr.cpp:16061
void DiagnoseShadowingLambdaDecls(const sema::LambdaScopeInfo *LSI)
Diagnose shadowing for variables shadowed in the lambda record LambdaRD when these variables are capt...
Definition: SemaDecl.cpp:8595
bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS, bool AllowBuiltinCreation=false, bool EnteringContext=false)
Performs name lookup for a name that was parsed in the source code, and may contain a C++ scope speci...
static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy)
ScalarTypeToBooleanCastKind - Returns the cast kind corresponding to the conversion from scalar type ...
Definition: Sema.cpp:754
void CodeCompleteNaturalLanguage()
void PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir)
void CodeCompleteOperatorName(Scope *S)
RecordDecl * CreateCapturedStmtRecordDecl(CapturedDecl *&CD, SourceLocation Loc, unsigned NumParams)
Definition: SemaStmt.cpp:4787
bool isLibstdcxxEagerExceptionSpecHack(const Declarator &D)
Determine if we're in a case where we need to (incorrectly) eagerly parse an exception specification ...
void CheckConstructor(CXXConstructorDecl *Constructor)
CheckConstructor - Checks a fully-formed constructor for well-formedness, issuing any diagnostics req...
void DefineImplicitLambdaToBlockPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a block pointer.
void AddCFAuditedAttribute(Decl *D)
AddCFAuditedAttribute - Check whether we're currently within '#pragma clang arc_cf_code_audited' and,...
Definition: SemaAttr.cpp:863
bool buildCoroutineParameterMoves(SourceLocation Loc)
void DefineImplicitDestructor(SourceLocation CurrentLocation, CXXDestructorDecl *Destructor)
DefineImplicitDestructor - Checks for feasibility of defining this destructor as the default destruct...
void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMemberKind CSM)
Diagnose why the specified class does not have a trivial special member of the given kind.
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
Definition: SemaCast.cpp:3359
DeclGroupPtrTy ActOnGlobalModuleFragmentDecl(SourceLocation ModuleLoc)
The parser has processed a global-module-fragment declaration that begins the definition of the globa...
Definition: SemaModule.cpp:162
bool CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, TemplateArgumentLoc &Arg, SmallVectorImpl< TemplateArgument > &SugaredConverted, SmallVectorImpl< TemplateArgument > &CanonicalConverted)
void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope, CapturedRegionKind Kind, unsigned NumParams)
Definition: SemaStmt.cpp:4855
bool AreConstraintExpressionsEqual(const NamedDecl *Old, const Expr *OldConstr, const TemplateCompareNewDeclInfo &New, const Expr *NewConstr)
bool CheckTollFreeBridgeStaticCast(QualType castType, Expr *castExpr, CastKind &Kind)
void CheckMSVCRTEntryPoint(FunctionDecl *FD)
Definition: SemaDecl.cpp:12744
FileNullabilityMap NullabilityMap
A mapping that describes the nullability we've seen in each header file.
Definition: Sema.h:11626
UuidAttr * mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI, StringRef UuidAsWritten, MSGuidDecl *GuidDecl)
ProcessingContextState ParsingClassState
Definition: Sema.h:5009
void CodeCompleteObjCProtocolReferences(ArrayRef< IdentifierLocPair > Protocols)
void DiagnoseMisalignedMembers()
Diagnoses the current set of gathered accesses.
ObjCMessageKind getObjCMessageKind(Scope *S, IdentifierInfo *Name, SourceLocation NameLoc, bool IsSuper, bool HasTrailingDot, ParsedType &ReceiverType)
CXXRecordDecl * getCurrentClass(Scope *S, const CXXScopeSpec *SS)
Get the class that is directly named by the current context.
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
Decl * ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant, SourceLocation IdLoc, IdentifierInfo *Id, const ParsedAttributesView &Attrs, SourceLocation EqualLoc, Expr *Val)
Definition: SemaDecl.cpp:20177
void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS)
checkUnsafeExprAssigns - Check whether +1 expr is being assigned to weak/__unsafe_unretained expressi...
SYCLIntelLoopCoalesceAttr * BuildSYCLIntelLoopCoalesceAttr(const AttributeCommonInfo &CI, Expr *E)
void PushCompoundScope(bool IsStmtExpr)
Definition: Sema.cpp:2378
bool usesPartialOrExplicitSpecialization(SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec)
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
Definition: SemaDecl.cpp:15133
FunctionDecl * CreateBuiltin(IdentifierInfo *II, QualType Type, unsigned ID, SourceLocation Loc)
Definition: SemaDecl.cpp:2400
FunctionTemplateDecl * getMoreSpecializedTemplate(FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, SourceLocation Loc, TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1, QualType RawObj1Ty={}, QualType RawObj2Ty={}, bool Reversed=false)
Returns the more specialized function template according to the rules of function template partial or...
ExprResult ActOnClassMessage(Scope *S, ParsedType Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
Scope * getNonFieldDeclScope(Scope *S)
getNonFieldDeclScope - Retrieves the innermost scope, starting from S, where a non-field would be dec...
Definition: SemaDecl.cpp:2375
ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S, IdentifierInfo *II, bool AllowBuiltinCreation=false)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
Definition: SemaExpr.cpp:3242
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
void pushCodeSynthesisContext(CodeSynthesisContext Ctx)
bool isDeclaratorFunctionLike(Declarator &D)
Determine whether.
Definition: Sema.cpp:2824
bool CheckLoopHintExpr(Expr *E, SourceLocation Loc, bool AllowZero)
Definition: SemaExpr.cpp:3954
QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc, DeclarationName Entity)
Build a reference type.
Definition: SemaType.cpp:2282
bool mightBeIntendedToBeTemplateName(ExprResult E, bool &Dependent)
Determine whether it's plausible that E was intended to be a template-name.
Definition: Sema.h:2902
SmallVectorImpl< Decl * > & WeakTopLevelDecls()
WeakTopLevelDeclDecls - access to #pragma weak-generated Decls.
Definition: Sema.h:3594
std::pair< const IdentifierInfo *, uint64_t > TypeTagMagicValue
A pair of ArgumentKind identifier and magic value.
Definition: Sema.h:1941
void ActOnPragmaWeakID(IdentifierInfo *WeakName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc)
ActOnPragmaWeakID - Called on well formed #pragma weak ident.
Definition: SemaDecl.cpp:20730
std::optional< unsigned > getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs)
Determine the number of arguments in the given pack expansion type.
QualType CheckSizelessVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, ArithConvKind OperationKind)
Definition: SemaExpr.cpp:10845
bool CheckNontrivialField(FieldDecl *FD)
Definition: SemaDecl.cpp:18986
void CodeCompleteObjCAtVisibility(Scope *S)
bool isValidPointerAttrType(QualType T, bool RefOkay=false)
Determine if type T is a valid subject for a nonnull and similar attributes.
TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg, QualType NTTPType, SourceLocation Loc)
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location.
AssignConvertType CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, bool Diagnose=true, bool DiagnoseCFAudited=false, bool ConvertRHS=true)
Check assignment constraints for an assignment of RHS to LHSType.
Definition: SemaExpr.cpp:10085
void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, Expr *SrcExpr)
DiagnoseAssignmentEnum - Warn if assignment to enum is a constant integer not in the range of enum va...
Definition: SemaStmt.cpp:1664
llvm::DenseMap< const VarDecl *, int > RefsMinusAssignments
Increment when we find a reference; decrement when we find an ignored assignment.
Definition: Sema.h:5354
ExprResult ActOnFinishTrailingRequiresClause(ExprResult ConstraintExpr)
void AddPushedVisibilityAttribute(Decl *RD)
AddPushedVisibilityAttribute - If '#pragma GCC visibility' was used, add an appropriate visibility at...
Definition: SemaAttr.cpp:1231
bool checkThisInStaticMemberFunctionAttributes(CXXMethodDecl *Method)
Check whether 'this' shows up in the attributes of the given static member function.
bool CheckExceptionSpecSubset(const PartialDiagnostic &DiagID, const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const PartialDiagnostic &NoThrowDiagID, const FunctionProtoType *Superset, bool SkipSupersetFirstParameter, SourceLocation SuperLoc, const FunctionProtoType *Subset, bool SkipSubsetFirstParameter, SourceLocation SubLoc)
CheckExceptionSpecSubset - Check whether the second function type's exception specification is a subs...
CXXRecordDecl * getCurrentInstantiationOf(NestedNameSpecifier *NNS)
If the given nested name specifier refers to the current instantiation, return the declaration that c...
void CodeCompleteNamespaceAliasDecl(Scope *S)
ExplicitSpecifier instantiateExplicitSpecifier(const MultiLevelTemplateArgumentList &TemplateArgs, ExplicitSpecifier ES)
void ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagDecl, SourceLocation FinalLoc, bool IsFinalSpelledSealed, bool IsAbstract, SourceLocation LBraceLoc)
ActOnStartCXXMemberDeclarations - Invoked when we have parsed a C++ record definition's base-specifie...
Definition: SemaDecl.cpp:18455
ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *input, bool RequiresADL=true)
Create a unary operation that may resolve to an overloaded operator.
TemplateDeductionResult SubstituteExplicitTemplateArguments(FunctionTemplateDecl *FunctionTemplate, TemplateArgumentListInfo &ExplicitTemplateArgs, SmallVectorImpl< DeducedTemplateArgument > &Deduced, SmallVectorImpl< QualType > &ParamTypes, QualType *FunctionType, sema::TemplateDeductionInfo &Info)
Substitute the explicitly-provided template arguments into the given function template according to C...
void DiagnosePropertyMismatch(ObjCPropertyDecl *Property, ObjCPropertyDecl *SuperProperty, const IdentifierInfo *Name, bool OverridingProtocolProperty)
DiagnosePropertyMismatch - Compares two properties for their attributes and types and warns on a vari...
ExprResult ActOnCoawaitExpr(Scope *S, SourceLocation KwLoc, Expr *E)
std::optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
CXXBaseSpecifier * CheckBaseSpecifier(CXXRecordDecl *Class, SourceRange SpecifierRange, bool Virtual, AccessSpecifier Access, TypeSourceInfo *TInfo, SourceLocation EllipsisLoc)
ActOnBaseSpecifier - Parsed a base specifier.
bool findMacroSpelling(SourceLocation &loc, StringRef name)
Looks through the macro-expansion chain for the given location, looking for a macro expansion with th...
Definition: Sema.cpp:2179
DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, TemplateParameterList *TemplateParams, AccessSpecifier AS, SourceLocation ModulePrivateLoc, SourceLocation FriendLoc, unsigned NumOuterTemplateParamLists, TemplateParameterList **OuterTemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
SYCLAddIRAttributesKernelParameterAttr * MergeSYCLAddIRAttributesKernelParameterAttr(Decl *D, const SYCLAddIRAttributesKernelParameterAttr &A)
ExprResult ActOnMemberAccessExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Member, Decl *ObjCImpDecl)
The main callback when the parser finds something like expression .
ExprResult BuildImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, bool IsDefiniteInstance, const Scope *S)
Builds an implicit member access expression.
UnparsedDefaultArgInstantiationsMap UnparsedDefaultArgInstantiations
A mapping from parameters with unparsed default arguments to the set of instantiations of each parame...
Definition: Sema.h:9992
QualType DeduceTemplateSpecializationFromInitializer(TypeSourceInfo *TInfo, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Init)
Definition: SemaInit.cpp:10743
void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitDefaultConstructor - Checks for feasibility of defining this constructor as the default...
bool SubstParmTypes(SourceLocation Loc, ArrayRef< ParmVarDecl * > Params, const FunctionProtoType::ExtParameterInfo *ExtParamInfos, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< QualType > &ParamTypes, SmallVectorImpl< ParmVarDecl * > *OutParams, ExtParameterInfoBuilder &ParamInfos)
Substitute the given template arguments into the given set of parameters, producing the set of parame...
void DiagnoseEmptyStmtBody(SourceLocation StmtLoc, const Stmt *Body, unsigned DiagID)
Emit DiagID if statement located on StmtLoc has a suspicious null statement as a Body,...
void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, TypeSourceInfo *T, bool IsPackExpansion)
void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool PartialOverloading=false)
Add the overload candidates named by callee and/or found by argument dependent lookup to the given ov...
bool CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous)
Perform semantic checking on a newly-created variable declaration.
Definition: SemaDecl.cpp:9113
void LateTemplateParserCleanupCB(void *P)
Definition: Sema.h:903
std::pair< CXXRecordDecl *, SourceLocation > VTableUse
The list of classes whose vtables have been used within this translation unit, and the source locatio...
Definition: Sema.h:4538
void MarkThisReferenced(CXXThisExpr *This)
bool MaybeEmitAmbiguousAtomicConstraintsDiagnostic(NamedDecl *D1, ArrayRef< const Expr * > AC1, NamedDecl *D2, ArrayRef< const Expr * > AC2)
If D1 was not at least as constrained as D2, but would've been if a pair of atomic constraints involv...
std::optional< unsigned > getFullyPackExpandedSize(TemplateArgument Arg)
Given a template argument that contains an unexpanded parameter pack, but which has already been subs...
void DiagnoseEmptyLoopBody(const Stmt *S, const Stmt *PossibleBody)
Warn if a for/while loop statement S, which is followed by PossibleBody, has a suspicious null statem...
ExprResult DefaultLvalueConversion(Expr *E)
Definition: SemaExpr.cpp:719
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
Definition: Sema.h:10492
void AddIntelReqdSubGroupSize(Decl *D, const AttributeCommonInfo &CI, Expr *E)
bool CheckUsingShadowDecl(BaseUsingDecl *BUD, NamedDecl *Target, const LookupResult &PreviousDecls, UsingShadowDecl *&PrevShadow)
Determines whether to create a using shadow decl for a particular decl, given the set of decls existi...
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
Definition: SemaExpr.cpp:3500
SourceLocation getLocationOfStringLiteralByte(const StringLiteral *SL, unsigned ByteNo) const
bool isVisible(const NamedDecl *D)
Determine whether a declaration is visible to name lookup.
Definition: Sema.h:11925
ExprResult BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S)
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base, SourceLocation Loc, SourceRange Range, CXXCastPath *BasePath=nullptr, bool IgnoreAccess=false)
bool isInLifetimeExtendingContext() const
Definition: Sema.h:6464
StringLiteral * CurInitSeg
Last section used with #pragma init_seg.
Definition: Sema.h:1452
FunctionEmissionStatus getEmissionStatus(const FunctionDecl *Decl, bool Final=false)
Definition: SemaDecl.cpp:20781
Decl * ActOnMethodDeclaration(Scope *S, SourceLocation BeginLoc, SourceLocation EndLoc, tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType, ArrayRef< SourceLocation > SelectorLocs, Selector Sel, ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo, unsigned CNumArgs, const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind, bool isVariadic, bool MethodDefinition)
bool CheckDeductionGuideDeclarator(Declarator &D, QualType &R, StorageClass &SC)
Check the validity of a declarator that we parsed for a deduction-guide.
bool AddOverriddenMethods(CXXRecordDecl *DC, CXXMethodDecl *MD)
AddOverriddenMethods - See if a method overrides any in the base classes, and if so,...
Definition: SemaDecl.cpp:9135
Selector RespondsToSelectorSel
will hold 'respondsToSelector:'
Definition: Sema.h:12425
void CodeCompleteAttribute(AttributeCommonInfo::Syntax Syntax, AttributeCompletion Completion=AttributeCompletion::Attribute, const IdentifierInfo *Scope=nullptr)
void maybeExtendBlockObject(ExprResult &E)
Do an explicit extend of the given block pointer if we're in ARC.
Definition: SemaExpr.cpp:7529
static bool isCast(CheckedConversionKind CCK)
Definition: Sema.h:1798
ExprResult ActOnGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, bool PredicateIsExpr, void *ControllingExprOrType, ArrayRef< ParsedType > ArgTypes, ArrayRef< Expr * > ArgExprs)
ControllingExprOrType is either an opaque pointer coming out of a ParsedType or an Expr *.
Definition: SemaExpr.cpp:1711
void DiagPlaceholderVariableDefinition(SourceLocation Loc)
void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockError - If there is an error parsing a block, this callback is invoked to pop the informati...
Definition: SemaExpr.cpp:16627
ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr)
Prepare SplattedExpr for a vector splat operation, adding implicit casts if necessary.
Definition: SemaExpr.cpp:7975
void NoteOverloadCandidate(const NamedDecl *Found, const FunctionDecl *Fn, OverloadCandidateRewriteKind RewriteKind=OverloadCandidateRewriteKind(), QualType DestType=QualType(), bool TakingAddress=false)
void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled)
void CheckForFunctionRedefinition(FunctionDecl *FD, const FunctionDecl *EffectiveDefinition=nullptr, SkipBodyInfo *SkipBody=nullptr)
Definition: SemaDecl.cpp:15703
bool hasReachableDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if the template parameter D has a reachable default argument.
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
Definition: Sema.cpp:2416
bool DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType)
bool DiagnoseUseOfOverloadedDecl(NamedDecl *D, SourceLocation Loc)
Definition: Sema.h:5380
IfExistsResult CheckMicrosoftIfExistsSymbol(Scope *S, CXXScopeSpec &SS, const DeclarationNameInfo &TargetNameInfo)
void ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc, ArrayRef< Expr * > Args, ADLResult &Functions)
bool BuiltinVectorMath(CallExpr *TheCall, QualType &Res)
std::unique_ptr< RecordDeclSetTy > PureVirtualClassDiagSet
PureVirtualClassDiagSet - a set of class declarations which we have emitted a list of pure virtual fu...
Definition: Sema.h:4972
void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init)
bool checkStringLiteralArgumentAttr(const AttributeCommonInfo &CI, const Expr *E, StringRef &Str, SourceLocation *ArgLocation=nullptr)
bool IvarBacksCurrentMethodAccessor(ObjCInterfaceDecl *IFace, ObjCMethodDecl *Method, ObjCIvarDecl *IV)
IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is an ivar synthesized for 'Meth...
bool ActOnDuplicateDefinition(Decl *Prev, SkipBodyInfo &SkipBody)
Perform ODR-like check for C/ObjC when merging tag types from modules.
Definition: SemaDecl.cpp:18440
void ActOnFinishInlineFunctionDef(FunctionDecl *D)
Definition: SemaDecl.cpp:15630
FunctionDecl * resolveAddressOfSingleOverloadCandidate(Expr *E, DeclAccessPair &FoundResult)
Given an expression that refers to an overloaded function, try to resolve that function to a single f...
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
Definition: Sema.h:997
bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD, DeclarationName Name, FunctionDecl *&Operator, bool Diagnose=true, bool WantSize=false, bool WantAligned=false)
SYCLIntelESimdVectorizeAttr * MergeSYCLIntelESimdVectorizeAttr(Decl *D, const SYCLIntelESimdVectorizeAttr &A)
MaterializeTemporaryExpr * CreateMaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference)
Definition: SemaInit.cpp:8536
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
bool CollectMultipleMethodsInGlobalPool(Selector Sel, SmallVectorImpl< ObjCMethodDecl * > &Methods, bool InstanceFirst, bool CheckTheOther, const ObjCObjectType *TypeBound=nullptr)
We first select the type of the method: Instance or Factory, then collect all methods with that type.
ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, ArrayRef< Expr * > Strings)
std::function< void(const TypoCorrection &)> TypoDiagnosticGenerator
Definition: Sema.h:7620
SYCLIntelSchedulerTargetFmaxMhzAttr * MergeSYCLIntelSchedulerTargetFmaxMhzAttr(Decl *D, const SYCLIntelSchedulerTargetFmaxMhzAttr &A)
ErrorAttr * mergeErrorAttr(Decl *D, const AttributeCommonInfo &CI, StringRef NewUserDiagnostic)
ExprResult checkUnknownAnyCast(SourceRange TypeRange, QualType CastType, Expr *CastExpr, CastKind &CastKind, ExprValueKind &VK, CXXCastPath &Path)
Check a cast of an unknown-any type.
Definition: SemaExpr.cpp:21201
void CodeCompleteObjCSuperclass(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
FormatAttr * mergeFormatAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Format, int FormatIdx, int FirstArg)
ExprResult ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, SourceLocation LAngleBracketLoc, Declarator &D, SourceLocation RAngleBracketLoc, SourceLocation LParenLoc, Expr *E, SourceLocation RParenLoc)
ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const,addrspace}_cast's.
Definition: SemaCast.cpp:276
DeclGroupPtrTy ActOnPrivateModuleFragmentDecl(SourceLocation ModuleLoc, SourceLocation PrivateLoc)
The parser has processed a private-module-fragment declaration that begins the definition of the priv...
Definition: SemaModule.cpp:510
DeclResult actOnObjCTypeParam(Scope *S, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, IdentifierInfo *paramName, SourceLocation paramLoc, SourceLocation colonLoc, ParsedType typeBound)
void ActOnDocumentableDecl(Decl *D)
Should be called on all declarations that might have attached documentation comments.
Definition: SemaDecl.cpp:15173
static const IdentifierInfo * getPrintable(const IdentifierInfo *II)
Definition: Sema.h:11634
SuppressedDiagnosticsMap SuppressedDiagnostics
Definition: Sema.h:9764
std::optional< ExpressionEvaluationContextRecord::InitializationContext > InnermostDeclarationWithDelayedImmediateInvocations() const
Definition: Sema.h:6478
@ VAK_Invalid
Definition: Sema.h:6222
@ VAK_Valid
Definition: Sema.h:6218
@ VAK_ValidInCXX11
Definition: Sema.h:6219
@ VAK_MSVCUndefined
Definition: Sema.h:6221
@ VAK_Undefined
Definition: Sema.h:6220
void ActOnPragmaMSFunction(SourceLocation Loc, const llvm::SmallVectorImpl< StringRef > &NoBuiltins)
Call on well formed #pragma function.
Definition: SemaAttr.cpp:1167
DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name)
Retrieves the declaration name from a parsed unqualified-id.
Definition: SemaDecl.cpp:5963
std::deque< PendingImplicitInstantiation > PendingLocalImplicitInstantiations
The queue of implicit template instantiations that are required and must be performed within the curr...
Definition: Sema.h:10723
SemaOpenACC & OpenACC()
Definition: Sema.h:1009
TypeSourceInfo * RebuildTypeInCurrentInstantiation(TypeSourceInfo *T, SourceLocation Loc, DeclarationName Name)
Rebuilds a type within the context of the current instantiation.
QualType BuiltinDecay(QualType BaseType, SourceLocation Loc)
Definition: SemaType.cpp:10080
void ActOnPragmaMSStruct(PragmaMSStructKind Kind)
ActOnPragmaMSStruct - Called on well formed #pragma ms_struct [on|off].
Definition: SemaAttr.cpp:514
Module * getCurrentModule() const
Get the module unit whose scope we are currently within.
Definition: Sema.h:7908
ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc)
Definition: SemaExpr.cpp:16991
bool CheckCountedByAttr(Scope *Scope, const FieldDecl *FD)
VisibilityAttr * mergeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI, VisibilityAttr::VisibilityType Vis)
bool AreMultipleMethodsInGlobalPool(Selector Sel, ObjCMethodDecl *BestMethod, SourceRange R, bool receiverIdOrClass, SmallVectorImpl< ObjCMethodDecl * > &Methods)
void CompleteMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
bool isPreciseFPEnabled()
Are precise floating point semantics currently enabled?
Definition: Sema.h:1578
ParmVarDecl * CheckParameter(DeclContext *DC, SourceLocation StartLoc, SourceLocation NameLoc, const IdentifierInfo *Name, QualType T, TypeSourceInfo *TSInfo, StorageClass SC)
Definition: SemaDecl.cpp:15467
IdentifierInfo * getNullabilityKeyword(NullabilityKind nullability)
Retrieve the keyword associated.
Definition: SemaType.cpp:4252
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
ExprResult ActOnPackIndexingExpr(Scope *S, Expr *PackExpression, SourceLocation EllipsisLoc, SourceLocation LSquareLoc, Expr *IndexExpr, SourceLocation RSquareLoc)
void DefineImplicitCopyAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared copy assignment operator.
void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation, StringLiteral *SegmentName)
Called on well-formed #pragma init_seg().
Definition: SemaAttr.cpp:790
AccessResult CheckConstructorAccess(SourceLocation Loc, CXXConstructorDecl *D, DeclAccessPair FoundDecl, const InitializedEntity &Entity, bool IsCopyBindingRefToTemp=false)
Checks access to a constructor.
static SourceRange getPrintable(TypeLoc TL)
Definition: Sema.h:11642
bool DiagnoseConditionalForNull(const Expr *LHSExpr, const Expr *RHSExpr, SourceLocation QuestionLoc)
Emit a specialized diagnostic when one expression is a null pointer constant and the other is not a p...
Definition: SemaExpr.cpp:8226
bool CheckFunctionConstraints(const FunctionDecl *FD, ConstraintSatisfaction &Satisfaction, SourceLocation UsageLoc=SourceLocation(), bool ForOverloadResolution=false)
Check whether the given function decl's trailing requires clause is satisfied, if any.
SemaSYCL & SYCL()
Definition: Sema.h:1019
bool SetDelegatingInitializer(CXXConstructorDecl *Constructor, CXXCtorInitializer *Initializer)
SYCLTypeAttr * MergeSYCLTypeAttr(Decl *D, const AttributeCommonInfo &CI, SYCLTypeAttr::SYCLType TypeName)
QualType QIDNSCopying
id<NSCopying> type.
Definition: Sema.h:12422
ParsedType getDestructorTypeForDecltype(const DeclSpec &DS, ParsedType ObjectType)
TrivialABIHandling
Definition: Sema.h:4837
@ TAH_IgnoreTrivialABI
The triviality of a method unaffected by "trivial_abi".
Definition: Sema.h:4839
@ TAH_ConsiderTrivialABI
The triviality of a method affected by "trivial_abi".
Definition: Sema.h:4842
FormatArgumentPassingKind
Definition: Sema.h:1873
@ FAPK_Fixed
Definition: Sema.h:1874
@ FAPK_Variadic
Definition: Sema.h:1875
@ FAPK_VAList
Definition: Sema.h:1876
void FillInlineAsmIdentifierInfo(Expr *Res, llvm::InlineAsmIdentifierInfo &Info)
CXXMethodDecl * LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the moving assignment operator for the given class.
void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T)
Mark all of the declarations referenced within a particular AST node as referenced.
Definition: SemaExpr.cpp:20430
bool BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, NamedDecl *ScopeLookupResult, bool ErrorRecoveryLookup, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
Build a new nested-name-specifier for "identifier::", as described by ActOnCXXNestedNameSpecifier.
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5.
Definition: Sema.h:6456
llvm::DenseMap< ParmVarDecl *, llvm::TinyPtrVector< ParmVarDecl * > > UnparsedDefaultArgInstantiationsMap
Definition: Sema.h:9983
DeclContext * getFunctionLevelDeclContext(bool AllowLambda=false) const
If AllowLambda is true, treat lambda as function.
Definition: Sema.cpp:1521
StmtResult ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, NamedReturnInfo &NRInfo, bool SupressSimplerImplicitMoves)
ActOnCapScopeReturnStmt - Utility routine to type-check return statements for capturing scopes.
Definition: SemaStmt.cpp:3650
MethodMatchStrategy
Definition: Sema.h:12051
@ MMS_strict
Definition: Sema.h:12051
@ MMS_loose
Definition: Sema.h:12051
Stmt * MaybeCreateStmtWithCleanups(Stmt *SubStmt)
AccessResult CheckAddressOfMemberAccess(Expr *OvlExpr, DeclAccessPair FoundDecl)
bool CheckLiteralOperatorDeclaration(FunctionDecl *FnDecl)
CheckLiteralOperatorDeclaration - Check whether the declaration of this literal operator function is ...
bool DefineUsedVTables()
Define all of the vtables that have been used in this translation unit and reference any virtual memb...
llvm::SmallVector< TypoExpr *, 2 > TypoExprs
Holds TypoExprs that are created from createDelayedTypo.
Definition: Sema.h:7531
AssignConvertType
AssignConvertType - All of the 'assignment' semantic checks return this enum to indicate whether the ...
Definition: Sema.h:6260
@ IncompatiblePointerDiscardsQualifiers
IncompatiblePointerDiscardsQualifiers - The assignment discards qualifiers that we don't permit to be...
Definition: Sema.h:6304
@ IntToPointer
IntToPointer - The assignment converts an int to a pointer, which we accept as an extension.
Definition: Sema.h:6270
@ IncompatibleBlockPointer
IncompatibleBlockPointer - The assignment is between two block pointers types that are not compatible...
Definition: Sema.h:6328
@ IncompatibleObjCQualifiedId
IncompatibleObjCQualifiedId - The assignment is between a qualified id type and something else (that ...
Definition: Sema.h:6333
@ IncompatibleVectors
IncompatibleVectors - The assignment is between two vector types that have the same size,...
Definition: Sema.h:6320
@ CompatiblePointerDiscardsQualifiers
CompatiblePointerDiscardsQualifiers - The assignment discards c/v/r qualifiers, which we accept as an...
Definition: Sema.h:6299
@ IncompatiblePointer
IncompatiblePointer - The assignment is between two pointers types that are not compatible,...
Definition: Sema.h:6278
@ IncompatibleObjCWeakRef
IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an object with __weak qualifier.
Definition: Sema.h:6337
@ Compatible
Compatible - the types are compatible according to the standard.
Definition: Sema.h:6262
@ IncompatibleFunctionPointerStrict
IncompatibleFunctionPointerStrict - The assignment is between two function pointer types that are not...
Definition: Sema.h:6289
@ Incompatible
Incompatible - We reject this conversion outright, it is invalid to represent it in the AST.
Definition: Sema.h:6341
@ FunctionVoidPointer
FunctionVoidPointer - The assignment is between a function pointer and void*, which the standard does...
Definition: Sema.h:6274
@ IncompatibleFunctionPointer
IncompatibleFunctionPointer - The assignment is between two function pointers types that are not comp...
Definition: Sema.h:6283
@ IncompatiblePointerSign
IncompatiblePointerSign - The assignment is between two pointers types which point to integers which ...
Definition: Sema.h:6295
@ IncompatibleNestedPointerQualifiers
IncompatibleNestedPointerQualifiers - The assignment is between two nested pointer types,...
Definition: Sema.h:6316
@ IncompatibleNestedPointerAddressSpaceMismatch
IncompatibleNestedPointerAddressSpaceMismatch - The assignment changes address spaces in nested point...
Definition: Sema.h:6310
@ PointerToInt
PointerToInt - The assignment converts a pointer to an int, which we accept as an extension.
Definition: Sema.h:6266
@ IntToBlockPointer
IntToBlockPointer - The assignment converts an int to a block pointer.
Definition: Sema.h:6324
CXXMethodDecl * DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit copy assignment operator for the given class.
QualType ProduceCtorInitMemberSignatureHelp(Decl *ConstructorDecl, CXXScopeSpec SS, ParsedType TemplateTypeTy, ArrayRef< Expr * > ArgExprs, IdentifierInfo *II, SourceLocation OpenParLoc, bool Braced)
ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, Declarator &D, Expr *Initializer)
ActOnCXXNew - Parsed a C++ 'new' expression.
void MarkVirtualBaseDestructorsReferenced(SourceLocation Location, CXXRecordDecl *ClassDecl, llvm::SmallPtrSetImpl< const RecordType * > *DirectVirtualBases=nullptr)
Mark destructors of virtual bases of this class referenced.
CXXConstructorDecl * LookupMovingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the moving constructor for the given class.
ParserCompletionContext
Describes the context in which code completion occurs.
Definition: Sema.h:12777
@ PCC_RecoveryInFunction
Code completion occurs within the body of a function on a recovery path, where we do not have a speci...
Definition: Sema.h:12811
@ PCC_LocalDeclarationSpecifiers
Code completion occurs within a sequence of declaration specifiers within a function,...
Definition: Sema.h:12819
@ PCC_Template
Code completion occurs following one or more template headers.
Definition: Sema.h:12793
@ PCC_MemberTemplate
Code completion occurs following one or more template headers within a class.
Definition: Sema.h:12796
@ PCC_Expression
Code completion occurs within an expression.
Definition: Sema.h:12798
@ PCC_ObjCInterface
Code completion occurs within an Objective-C interface, protocol, or category.
Definition: Sema.h:12784
@ PCC_TopLevelOrExpression
Code completion occurs at top-level in a REPL session.
Definition: Sema.h:12821
@ PCC_Class
Code completion occurs within a class, struct, or union.
Definition: Sema.h:12781
@ PCC_ObjCImplementation
Code completion occurs within an Objective-C implementation or category implementation.
Definition: Sema.h:12787
@ PCC_ParenthesizedExpression
Code completion occurs in a parenthesized expression, which might also be a type cast.
Definition: Sema.h:12816
@ PCC_Namespace
Code completion occurs at top-level or namespace context.
Definition: Sema.h:12779
@ PCC_Type
Code completion occurs where only a type is permitted.
Definition: Sema.h:12813
@ PCC_Condition
Code completion occurs within the condition of an if, while, switch, or for statement.
Definition: Sema.h:12807
@ PCC_ForInit
Code completion occurs at the beginning of the initialization statement (or expression) in a for loop...
Definition: Sema.h:12804
@ PCC_Statement
Code completion occurs within a statement, which may also be an expression or a declaration.
Definition: Sema.h:12801
@ PCC_ObjCInstanceVariableList
Code completion occurs within the list of instance variables in an Objective-C interface,...
Definition: Sema.h:12790
void checkIllFormedTrivialABIStruct(CXXRecordDecl &RD)
Check that the C++ class annoated with "trivial_abi" satisfies all the conditions that are needed for...
SourceManager & getSourceManager() const
Definition: Sema.h:526
ExprResult BuildPackIndexingExpr(Expr *PackExpression, SourceLocation EllipsisLoc, Expr *IndexExpr, SourceLocation RSquareLoc, ArrayRef< Expr * > ExpandedExprs={}, bool EmptyPack=false)
void CheckShadowingDeclModification(Expr *E, SourceLocation Loc)
Warn if 'E', which is an expression that is about to be modified, refers to a shadowing declaration.
Definition: SemaDecl.cpp:8637
static const char * getPrintable(const char *S)
Definition: Sema.h:11631
void AddSYCLIntelNoGlobalWorkOffsetAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
TemplateNameKindForDiagnostics getTemplateNameKindForDiagnostics(TemplateName Name)
Definition: SemaDecl.cpp:1310
bool DiagnoseSwiftName(Decl *D, StringRef Name, SourceLocation Loc, const ParsedAttr &AL, bool IsAsync)
Do a check to make sure Name looks like a legal argument for the swift_name attribute applied to decl...
StmtResult ActOnCapturedRegionEnd(Stmt *S)
Definition: SemaStmt.cpp:4959
ArithConvKind
Context in which we're performing a usual arithmetic conversion.
Definition: Sema.h:6103
@ ACK_Arithmetic
An arithmetic operation.
Definition: Sema.h:6105
@ ACK_CompAssign
A compound assignment expression.
Definition: Sema.h:6113
@ ACK_BitwiseOp
A bitwise operation.
Definition: Sema.h:6107
@ ACK_Conditional
A conditional (?:) operator.
Definition: Sema.h:6111
@ ACK_Comparison
A comparison.
Definition: Sema.h:6109
void notePreviousDefinition(const NamedDecl *Old, SourceLocation New)
Definition: SemaDecl.cpp:4863
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
Definition: SemaExpr.cpp:20324
void applyFunctionAttributesBeforeParsingBody(Decl *FD)
Definition: SemaDecl.cpp:16036
ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, SourceLocation RParen)
bool CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, TemplateSpecializationKind ActOnExplicitInstantiationNewTSK, NamedDecl *PrevDecl, TemplateSpecializationKind PrevTSK, SourceLocation PrevPtOfInstantiation, bool &SuppressNew)
Diagnose cases where we have an explicit template specialization before/after an explicit template in...
bool isAcceptable(const NamedDecl *D, AcceptableKind Kind)
Determine whether a declaration is acceptable (visible/reachable).
Definition: Sema.h:11938
ObjCMethodDecl * LookupImplementedMethodInGlobalPool(Selector Sel)
LookupImplementedMethodInGlobalPool - Returns the method which has an implementation.
void RestoreNestedNameSpecifierAnnotation(void *Annotation, SourceRange AnnotationRange, CXXScopeSpec &SS)
Given an annotation pointer for a nested-name-specifier, restore the nested-name-specifier structure.
QualType getDecltypeForExpr(Expr *E)
getDecltypeForExpr - Given an expr, will return the decltype for that expression, according to the ru...
Definition: SemaType.cpp:9900
void AddSYCLAddIRAttributesKernelParameterAttr(Decl *D, const AttributeCommonInfo &CI, MutableArrayRef< Expr * > Args)
ObjCContainerDecl * getObjCDeclContext() const
Definition: SemaDecl.cpp:20760
CXXMethodDecl * LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the copying assignment operator for the given class.
bool CheckTypeConstraint(TemplateIdAnnotation *TypeConstraint)
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
Definition: SemaStmt.cpp:2165
bool isKnownName(StringRef name)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
Definition: SemaStmt.cpp:3339
bool GlobalNewDeleteDeclared
A flag to remember whether the implicit forms of operator new and delete have been declared.
Definition: Sema.h:6656
InternalLinkageAttr * mergeInternalLinkageAttr(Decl *D, const InternalLinkageAttr &AL)
TemplateNameKind ActOnTemplateName(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool AllowInjectedClassName=false)
Form a template name from a name that is syntactically required to name a template,...
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
Definition: SemaExpr.cpp:4407
ExprResult ActOnSourceLocExpr(SourceLocIdentKind Kind, SourceLocation BuiltinLoc, SourceLocation RPLoc)
Definition: SemaExpr.cpp:17076
DeclContext * OriginalLexicalContext
Generally null except when we temporarily switch decl contexts, like in.
Definition: Sema.h:2648
llvm::PointerIntPair< ConstantExpr *, 1 > ImmediateInvocationCandidate
Definition: Sema.h:5191
bool MSStructPragmaOn
Definition: Sema.h:1164
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
Definition: SemaExpr.cpp:21293
bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a visible definition.
Definition: SemaType.cpp:9490
ExprResult TransformToPotentiallyEvaluated(Expr *E)
Definition: SemaExpr.cpp:17718
unsigned ActOnReenterTemplateScope(Decl *Template, llvm::function_ref< Scope *()> EnterScope)
EnableIfAttr * CheckEnableIf(FunctionDecl *Function, SourceLocation CallLoc, ArrayRef< Expr * > Args, bool MissingImplicitThis=false)
Check the enable_if expressions on the given function.
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, CXXConstructionKind ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
bool AllWorkGroupSizesSame(const Expr *LHSXDim, const Expr *LHSYDim, const Expr *LHSZDim, const Expr *RHSXDim, const Expr *RHSYDim, const Expr *RHSZDim)
unsigned NonInstantiationEntries
The number of CodeSynthesisContexts that are not template instantiations and, therefore,...
Definition: Sema.h:10468
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
Definition: Sema.h:12033
bool canSkipFunctionBody(Decl *D)
Determine whether we can skip parsing the body of a function definition, assuming we don't care about...
Definition: SemaDecl.cpp:16097
bool canFullyTypeCheckRedeclaration(ValueDecl *NewD, ValueDecl *OldD, QualType NewT, QualType OldT)
Determines if we can perform a correct type check for D as a redeclaration of PrevDecl.
Definition: SemaDecl.cpp:11220
ExprResult CreateUnresolvedLookupExpr(CXXRecordDecl *NamingClass, NestedNameSpecifierLoc NNSLoc, DeclarationNameInfo DNI, const UnresolvedSetImpl &Fns, bool PerformADL=true)
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
Definition: Sema.h:10677
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
Definition: Sema.h:3169
@ NTK_Typedef
Definition: Sema.h:3174
@ NTK_NonUnion
Definition: Sema.h:3172
@ NTK_TypeAlias
Definition: Sema.h:3175
@ NTK_NonClass
Definition: Sema.h:3171
@ NTK_NonEnum
Definition: Sema.h:3173
@ NTK_NonStruct
Definition: Sema.h:3170
@ NTK_TemplateTemplateArgument
Definition: Sema.h:3178
@ NTK_TypeAliasTemplate
Definition: Sema.h:3177
@ NTK_Template
Definition: Sema.h:3176
bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID)
Definition: Sema.h:11913
void ActOnObjCContainerFinishDefinition()
Definition: SemaDecl.cpp:18556
void AddAssumeAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, Expr *OE)
AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular declaration.
void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod)
Definition: SemaModule.cpp:725
TryCaptureKind
Definition: Sema.h:5444
@ TryCapture_Implicit
Definition: Sema.h:5445
@ TryCapture_ExplicitByVal
Definition: Sema.h:5446
@ TryCapture_ExplicitByRef
Definition: Sema.h:5447
void AddSYCLIntelMaxGlobalWorkDimAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
QualType BuiltinAddReference(QualType BaseType, UTTKind UKind, SourceLocation Loc)
Definition: SemaType.cpp:10096
bool isCFError(RecordDecl *D)
Definition: SemaType.cpp:4462
QualType CXXThisTypeOverride
When non-NULL, the C++ 'this' expression is allowed despite the current context not being a non-stati...
Definition: Sema.h:6717
AssignmentAction
Definition: Sema.h:5365
@ AA_Returning
Definition: Sema.h:5368
@ AA_Passing_CFAudited
Definition: Sema.h:5373
@ AA_Initializing
Definition: Sema.h:5370
@ AA_Converting
Definition: Sema.h:5369
@ AA_Assigning
Definition: Sema.h:5366
@ AA_Passing
Definition: Sema.h:5367
@ AA_Casting
Definition: Sema.h:5372
@ AA_Sending
Definition: Sema.h:5371
FunctionDecl * SubstSpaceshipAsEqualEqual(CXXRecordDecl *RD, FunctionDecl *Spaceship)
Substitute the name and return type of a defaulted 'operator<=>' to form an implicit 'operator=='.
CallingConventionIgnoredReason
Describes the reason a calling convention specification was ignored, used for diagnostics.
Definition: Sema.h:3579
NamedDecl * ActOnDecompositionDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists)
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
Definition: SemaExpr.cpp:6952
ExprResult checkPseudoObjectRValue(Expr *E)
bool CheckVecStepExpr(Expr *E)
Definition: SemaExpr.cpp:4680
SYCLWorkGroupSizeHintAttr * MergeSYCLWorkGroupSizeHintAttr(Decl *D, const SYCLWorkGroupSizeHintAttr &A)
bool makeUnavailableInSystemHeader(SourceLocation loc, UnavailableAttr::ImplicitReason reason)
makeUnavailableInSystemHeader - There is an error in the current context.
Definition: Sema.cpp:556
bool isModuleVisible(const Module *M, bool ModulePrivate=false)
Decl * ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, MultiTemplateParamsArg TemplateParams)
Handle a friend type declaration.
void AddMethodCandidate(DeclAccessPair FoundDecl, QualType ObjectType, Expr::Classification ObjectClassification, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversion=false, OverloadCandidateParamOrder PO={})
AddMethodCandidate - Adds a named decl (which is some kind of method) as a method candidate to the gi...
llvm::DenseMap< const EnumDecl *, llvm::APInt > FlagBitsCache
A cache of the flags available in enumerations with the flag_bits attribute.
Definition: Sema.h:2601
ObjCCategoryDecl * ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, const IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, const IdentifierInfo *CategoryName, SourceLocation CategoryLoc, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList)
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
bool CheckRebuiltStmtAttributes(ArrayRef< const Attr * > Attrs)
void diagnoseExprIntendedAsTemplateName(Scope *S, ExprResult TemplateName, SourceLocation Less, SourceLocation Greater)
void CodeCompleteBracketDeclarator(Scope *S)
std::optional< ExpressionEvaluationContextRecord::InitializationContext > OutermostDeclarationWithDelayedImmediateInvocations() const
Definition: Sema.h:6493
void DiagnoseMissingDesignatedInitOverrides(const ObjCImplementationDecl *ImplD, const ObjCInterfaceDecl *IFD)
bool MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old, Scope *S, bool MergeTypeWithOld)
Completes the merge of two function declarations that are known to be compatible.
Definition: SemaDecl.cpp:4420
bool hasVisibleMergedDefinition(const NamedDecl *Def)
void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange, Decl *EnumDecl, ArrayRef< Decl * > Elements, Scope *S, const ParsedAttributesView &Attr)
Definition: SemaDecl.cpp:20432
void DeclareImplicitDeductionGuides(TemplateDecl *Template, SourceLocation Loc)
Declare implicit deduction guides for a class template if we've not already done so.
void diagnoseEquivalentInternalLinkageDeclarations(SourceLocation Loc, const NamedDecl *D, ArrayRef< const NamedDecl * > Equiv)
void EnterDeclaratorContext(Scope *S, DeclContext *DC)
EnterDeclaratorContext - Used when we must lookup names in the context of a declarator's nested name ...
Definition: SemaDecl.cpp:1364
ClassTemplateDecl * lookupCoroutineTraits(SourceLocation KwLoc, SourceLocation FuncLoc)
Lookup 'coroutine_traits' in std namespace and std::experimental namespace.
StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope)
Definition: SemaStmt.cpp:4366
void diagnoseARCUnbridgedCast(Expr *e)
Given that we saw an expression with the ARCUnbridgedCastTy placeholder type, complain bitterly.
bool CheckNoInlineAttr(const Stmt *OrigSt, const Stmt *CurSt, const AttributeCommonInfo &A)
ExprResult FixOverloadedFunctionReference(Expr *E, DeclAccessPair FoundDecl, FunctionDecl *Fn)
FixOverloadedFunctionReference - E is an expression that refers to a C++ overloaded function (possibl...
const DeclContext * getCurObjCLexicalContext() const
Definition: Sema.h:5935
bool TemplateParameterListsAreEqual(TemplateParameterList *New, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Definition: Sema.h:9540
bool areMultiversionVariantFunctionsCompatible(const FunctionDecl *OldFD, const FunctionDecl *NewFD, const PartialDiagnostic &NoProtoDiagID, const PartialDiagnosticAt &NoteCausedDiagIDAt, const PartialDiagnosticAt &NoSupportDiagIDAt, const PartialDiagnosticAt &DiffDiagIDAt, bool TemplatesSupported, bool ConstexprSupported, bool CLinkageMayDiffer)
Checks if the variant/multiversion functions are compatible.
Definition: SemaDecl.cpp:11392
ExprResult PerformMoveOrCopyInitialization(const InitializedEntity &Entity, const NamedReturnInfo &NRInfo, Expr *Value, bool SupressSimplerImplicitMoves=false)
Perform the initialization of a potentially-movable value, which is the result of return value.
Definition: SemaStmt.cpp:3607
bool CheckExplicitlyDefaultedComparison(Scope *S, FunctionDecl *MD, DefaultedComparisonKind DCK)
void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, ObjCInterfaceDecl *ID)
DiagnoseClassExtensionDupMethods - Check for duplicate declaration of a class method in its extension...
ObjCInterfaceDecl * NSArrayDecl
The declaration of the Objective-C NSArray class.
Definition: Sema.h:12410
bool checkThisInStaticMemberFunctionExceptionSpec(CXXMethodDecl *Method)
Whether this' shows up in the exception specification of a static member function.
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?: operation.
Definition: SemaExpr.cpp:9232
bool CheckTemplateTemplateArgument(TemplateTemplateParmDecl *Param, TemplateParameterList *Params, TemplateArgumentLoc &Arg)
Check a template argument against its corresponding template template parameter.
QualType CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
CheckVectorCompareOperands - vector comparisons are a clang extension that operates on extended vecto...
Definition: SemaExpr.cpp:13148
ExprResult ActOnDependentMemberExpr(Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
bool CheckRebuiltAttributedStmtAttributes(ArrayRef< const Attr * > Attrs)
void ActOnLambdaExplicitTemplateParameterList(LambdaIntroducer &Intro, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > TParams, SourceLocation RAngleLoc, ExprResult RequiresClause)
This is called after parsing the explicit template parameter list on a lambda (if it exists) in C++2a...
Definition: SemaLambda.cpp:504
QualType CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool IsDivide)
Definition: SemaExpr.cpp:11020
ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr=false)
CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
DeclResult CheckVarTemplateId(VarTemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation TemplateNameLoc, const TemplateArgumentListInfo &TemplateArgs)
Get the specialization of the given variable template corresponding to the specified argument list,...
llvm::FoldingSet< SpecialMemberOverloadResultEntry > SpecialMemberCache
A cache of special member function overload resolution results for C++ records.
Definition: Sema.h:7525
ExprResult CheckLValueToRValueConversionOperand(Expr *E)
Definition: SemaExpr.cpp:19933
QualType BuildPackIndexingType(QualType Pattern, Expr *IndexExpr, SourceLocation Loc, SourceLocation EllipsisLoc, bool FullySubstituted=false, ArrayRef< QualType > Expansions={})
Definition: SemaType.cpp:10000
QualType CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType, BinaryOperatorKind Opc)
Definition: SemaExpr.cpp:14105
void DiagnoseNonDefaultPragmaAlignPack(PragmaAlignPackDiagnoseKind Kind, SourceLocation IncludeLoc)
Definition: SemaAttr.cpp:448
Decl * ActOnStartLinkageSpecification(Scope *S, SourceLocation ExternLoc, Expr *LangStr, SourceLocation LBraceLoc)
ActOnStartLinkageSpecification - Parsed the beginning of a C++ linkage specification,...
bool ActOnCXXNestedNameSpecifierIndexedPack(CXXScopeSpec &SS, const DeclSpec &DS, SourceLocation ColonColonLoc, QualType Type)
void ActOnTagStartDefinition(Scope *S, Decl *TagDecl)
ActOnTagStartDefinition - Invoked when we have entered the scope of a tag's definition (e....
Definition: SemaDecl.cpp:18426
void FilterUsingLookup(Scope *S, LookupResult &lookup)
Remove decls we can't actually see from a lookup being used to declare shadow using decls.
CanThrowResult canThrow(const Stmt *E)
Decl * SubstDecl(Decl *D, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
bool isThisOutsideMemberFunctionBody(QualType BaseType)
Determine whether the given type is the type of *this that is used outside of the body of a member fu...
bool AccessCheckingSFINAE
When true, access checking violations are treated as SFINAE failures rather than hard errors.
Definition: Sema.h:9696
void actOnDelayedExceptionSpecification(Decl *Method, ExceptionSpecificationType EST, SourceRange SpecificationRange, ArrayRef< ParsedType > DynamicExceptions, ArrayRef< SourceRange > DynamicExceptionRanges, Expr *NoexceptExpr)
Add an exception-specification to the given member function (or member function template).
Decl * ActOnExceptionDeclarator(Scope *S, Declarator &D)
ActOnExceptionDeclarator - Parsed the exception-declarator in a C++ catch handler.
bool CheckAlwaysInlineAttr(const Stmt *OrigSt, const Stmt *CurSt, const AttributeCommonInfo &A)
void DiscardMisalignedMemberAddress(const Type *T, Expr *E)
This function checks if the expression is in the sef of potentially misaligned members and it is conv...
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S)
Builds an expression which might be an implicit member expression.
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
bool LookupInlineAsmField(StringRef Base, StringRef Member, unsigned &Offset, SourceLocation AsmLoc)
PragmaClangSection PragmaClangTextSection
Definition: Sema.h:1191
ExprResult ActOnObjCBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
Definition: SemaExpr.cpp:21471
bool resolveAndFixAddressOfSingleOverloadCandidate(ExprResult &SrcExpr, bool DoFunctionPointerConversion=false)
Given an overloaded function, tries to turn it into a non-overloaded function reference using resolve...
void WarnConflictingTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
CallExpr::ADLCallKind ADLCallKind
Definition: Sema.h:5732
LabelDecl * LookupOrCreateLabel(IdentifierInfo *II, SourceLocation IdentLoc, SourceLocation GnuLabelLoc=SourceLocation())
LookupOrCreateLabel - Do a name lookup of a label with the specified name.
void AddSYCLIntelForcePow2DepthAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
void ActOnFinishCXXInClassMemberInitializer(Decl *VarDecl, SourceLocation EqualLoc, Expr *Init)
This is invoked after parsing an in-class initializer for a non-static C++ class member,...
ARCConversionResult CheckObjCConversion(SourceRange castRange, QualType castType, Expr *&op, CheckedConversionKind CCK, bool Diagnose=true, bool DiagnoseCFAudited=false, BinaryOperatorKind Opc=BO_PtrMemD)
Checks for invalid conversions and casts between retainable pointers and other pointer kinds for ARC ...
NonTrivialCUnionKind
Definition: Sema.h:3034
@ NTCUK_Destruct
Definition: Sema.h:3036
@ NTCUK_Init
Definition: Sema.h:3035
@ NTCUK_Copy
Definition: Sema.h:3037
QualType CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI, SourceLocation Loc)
Check that the type of a non-type template parameter is well-formed.
QualType CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, SourceLocation OpLoc, bool isIndirect)
DelayedDiagnosticsState ProcessingContextState
Definition: Sema.h:934
void CheckLookupAccess(const LookupResult &R)
Checks access to all the declarations in the given result set.
concepts::ExprRequirement * BuildExprRequirement(Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc, concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement)
void ActOnPragmaFPValueChangingOption(SourceLocation Loc, PragmaFPKind Kind, bool IsEnabled)
Called on well formed #pragma clang fp reassociate or #pragma clang fp reciprocal.
Definition: SemaAttr.cpp:1300
QualType BuildAtomicType(QualType T, SourceLocation Loc)
Definition: SemaType.cpp:10283
QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
PragmaClangSection PragmaClangDataSection
Definition: Sema.h:1188
bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement, const PartialDiagnostic &PD)
Conditionally issue a diagnostic based on the current evaluation context.
Definition: SemaExpr.cpp:20571
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body)
Definition: SemaDecl.cpp:16125
ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param, Expr *Init=nullptr)
BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating the default expr if needed.
Definition: SemaExpr.cpp:5775
Decl * ActOnPropertyImplDecl(Scope *S, SourceLocation AtLoc, SourceLocation PropertyLoc, bool ImplKind, IdentifierInfo *PropertyId, IdentifierInfo *PropertyIvar, SourceLocation PropertyIvarLoc, ObjCPropertyQueryKind QueryKind)
ActOnPropertyImplDecl - This routine performs semantic checks and builds the AST node for a property ...
void diagnoseMissingImport(SourceLocation Loc, const NamedDecl *Decl, MissingImportKind MIK, bool Recover=true)
Diagnose that the specified declaration needs to be visible but isn't, and suggest a module import th...
ParsedType actOnLambdaInitCaptureInitialization(SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc, IdentifierInfo *Id, LambdaCaptureInitKind InitKind, Expr *&Init)
Perform initialization analysis of the init-capture and perform any implicit conversions such as an l...
Definition: Sema.h:7321
void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, bool AllowExplicitConversion=false, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, ConversionSequenceList EarlyConversions=std::nullopt, OverloadCandidateParamOrder PO={}, bool AggregateCandidateDeduction=false)
AddOverloadCandidate - Adds the given function to the set of candidate functions, using the given fun...
void ActOnInitializerError(Decl *Dcl)
ActOnInitializerError - Given that there was an error parsing an initializer for the given declaratio...
Definition: SemaDecl.cpp:14115
bool anyAltivecTypes(QualType srcType, QualType destType)
Definition: SemaExpr.cpp:7860
void FilterAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates=true, bool AllowDependent=true)
TypeSourceInfo * SubstAutoTypeSourceInfoDependent(TypeSourceInfo *TypeWithAuto)
bool isLaxVectorConversion(QualType srcType, QualType destType)
Is this a legal conversion between two types, one of which is known to be a vector type?
Definition: SemaExpr.cpp:7906
void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr, SourceLocation Loc)
PushNamespaceVisibilityAttr - Note that we've entered a namespace with a visibility attribute.
Definition: SemaAttr.cpp:1380
ExprResult LookupInlineAsmVarDeclField(Expr *RefExpr, StringRef Member, SourceLocation AsmLoc)
ExprResult ActOnNameClassifiedAsUndeclaredNonType(IdentifierInfo *Name, SourceLocation NameLoc)
Act on the result of classifying a name as an undeclared (ADL-only) non-type declaration.
Definition: SemaDecl.cpp:1249
void keepInLifetimeExtendingContext()
keepInLifetimeExtendingContext - Pull down InLifetimeExtendingContext flag from previous context.
Definition: Sema.h:6511
StmtResult ActOnCXXForRangeStmt(Scope *S, SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, Stmt *LoopVar, SourceLocation ColonLoc, Expr *Collection, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
ActOnCXXForRangeStmt - Check and build a C++11 for-range statement.
Definition: SemaStmt.cpp:2516
void PushBlockScope(Scope *BlockScope, BlockDecl *Block)
Definition: Sema.cpp:2238
bool IsAtLeastAsConstrained(NamedDecl *D1, MutableArrayRef< const Expr * > AC1, NamedDecl *D2, MutableArrayRef< const Expr * > AC2, bool &Result)
Check whether the given declaration's associated constraints are at least as constrained than another...
SYCLIntelMaxGlobalWorkDimAttr * MergeSYCLIntelMaxGlobalWorkDimAttr(Decl *D, const SYCLIntelMaxGlobalWorkDimAttr &A)
sema::FunctionScopeInfo * getCurFunctionAvailabilityContext()
Retrieve the current function, if any, that should be analyzed for potential availability violations.
void ActOnDefaultCtorInitializers(Decl *CDtorDecl)
void ActOnMemInitializers(Decl *ConstructorDecl, SourceLocation ColonLoc, ArrayRef< CXXCtorInitializer * > MemInits, bool AnyErrors)
ActOnMemInitializers - Handle the member initializers for a constructor.
ExprResult BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig, bool AllowTypoCorrection=true, bool CalleesAddressIsTaken=false)
BuildOverloadedCallExpr - Given the call expression that calls Fn (which eventually refers to the dec...
void ActOnPragmaRedefineExtname(IdentifierInfo *WeakName, IdentifierInfo *AliasName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc, SourceLocation AliasNameLoc)
ActOnPragmaRedefineExtname - Called on well formed #pragma redefine_extname oldname newname.
Definition: SemaDecl.cpp:20703
bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams)
Check whether a template can be declared within this scope.
PragmaStack< MSVtorDispMode > VtorDispStack
Whether to insert vtordisps prior to virtual bases in the Microsoft C++ ABI.
Definition: Sema.h:1401
TypeSourceInfo * ReplaceAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto, QualType Replacement)
void AddMsStructLayoutForRecord(RecordDecl *RD)
AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
Definition: SemaAttr.cpp:89
QualType CXXCheckConditionalOperands(ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc)
Check the operands of ?: under C++ semantics.
ExprResult BuildAnonymousStructUnionMemberReference(const CXXScopeSpec &SS, SourceLocation nameLoc, IndirectFieldDecl *indirectField, DeclAccessPair FoundDecl=DeclAccessPair::make(nullptr, AS_none), Expr *baseObjectExpr=nullptr, SourceLocation opLoc=SourceLocation())
TypeResult ActOnTypeName(Declarator &D)
Definition: SemaType.cpp:6839
void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
Definition: Sema.h:12351
TemplateParameterList * SubstTemplateParams(TemplateParameterList *Params, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs, bool EvaluateConstraints=true)
MaybeODRUseExprSet MaybeODRUseExprs
Definition: Sema.h:5189
void ActOnLambdaClosureQualifiers(LambdaIntroducer &Intro, SourceLocation MutableLoc)
ExprResult PerformImplicitConversion(Expr *From, QualType ToType, const ImplicitConversionSequence &ICS, AssignmentAction Action, CheckedConversionKind CCK=CheckedConversionKind::Implicit)
PerformImplicitConversion - Perform an implicit conversion of the expression From to the type ToType ...
void ActOnCXXEnterDeclInitializer(Scope *S, Decl *Dcl)
ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an initializer for the declaration ...
unsigned FunctionScopesStart
The index of the first FunctionScope that corresponds to the current context.
Definition: Sema.h:812
void * VisContext
VisContext - Manages the stack for #pragma GCC visibility.
Definition: Sema.h:1459
SourceLocation getTopMostPointOfInstantiation(const NamedDecl *) const
Returns the top most location responsible for the definition of N.
QualType FindCompositePointerType(SourceLocation Loc, ExprResult &E1, ExprResult &E2, bool ConvertArgs=true)
Definition: Sema.h:6984
bool InstantiateInClassInitializer(SourceLocation PointOfInstantiation, FieldDecl *Instantiation, FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the definition of a field from the given pattern.
void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope, bool IsInstantiation=false)
ActOnLambdaError - If there is an error parsing a lambda, this callback is invoked to pop the informa...
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr, bool SkipTrailingRequiresClause=false)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
Definition: SemaExpr.cpp:227
static SourceRange getPrintable(SourceRange R)
Definition: Sema.h:11639
bool CheckParmsForFunctionDef(ArrayRef< ParmVarDecl * > Parameters, bool CheckParameterNames)
CheckParmsForFunctionDef - Check that the parameters of the given function are appropriate for the de...
void ActOnFinishCXXMemberSpecification(Scope *S, SourceLocation RLoc, Decl *TagDecl, SourceLocation LBrac, SourceLocation RBrac, const ParsedAttributesView &AttrList)
void AddSYCLIntelBankBitsAttr(Decl *D, const AttributeCommonInfo &CI, Expr **Exprs, unsigned Size)
TopLevelStmtDecl * ActOnStartTopLevelStmtDecl(Scope *S)
Definition: SemaDecl.cpp:20687
concepts::Requirement * ActOnTypeRequirement(SourceLocation TypenameKWLoc, CXXScopeSpec &SS, SourceLocation NameLoc, const IdentifierInfo *TypeName, TemplateIdAnnotation *TemplateId)
SemaHLSL & HLSL()
Definition: Sema.h:1004
void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, const LookupResult &R)
Diagnose variable or built-in function shadowing.
Definition: SemaDecl.cpp:8477
SYCLIntelNumBanksAttr * MergeSYCLIntelNumBanksAttr(Decl *D, const SYCLIntelNumBanksAttr &A)
ParsedTemplateArgument ActOnPackExpansion(const ParsedTemplateArgument &Arg, SourceLocation EllipsisLoc)
Invoked when parsing a template argument followed by an ellipsis, which creates a pack expansion.
void ActOnUndeclaredTypeTemplateName(Scope *S, TemplateTy &Name, TemplateNameKind &TNK, SourceLocation NameLoc, IdentifierInfo *&II)
Try to resolve an undeclared template name as a type template.
ParsedType getInheritingConstructorName(CXXScopeSpec &SS, SourceLocation NameLoc, const IdentifierInfo &Name)
Handle the result of the special case name lookup for inheriting constructor declarations.
Definition: SemaExprCXX.cpp:60
ExprResult BuildCallToObjectOfClassType(Scope *S, Expr *Object, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc)
BuildCallToObjectOfClassType - Build a call to an object of class type (C++ [over....
void AdjustDestructorExceptionSpec(CXXDestructorDecl *Destructor)
Build an exception spec for destructors that don't have one.
Decl * ActOnStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *AssertMessageExpr, SourceLocation RParenLoc)
ExprResult ActOnStringLiteral(ArrayRef< Token > StringToks, Scope *UDLScope=nullptr)
ActOnStringLiteral - The specified tokens were lexed as pasted string fragments (e....
Definition: SemaExpr.cpp:2126
bool CheckMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
Perform semantic analysis for the given non-template member specialization.
OptimizeNoneAttr * mergeOptimizeNoneAttr(Decl *D, const AttributeCommonInfo &CI)
void PushSatisfactionStackEntry(const NamedDecl *D, const llvm::FoldingSetNodeID &ID)
Definition: Sema.h:11376
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
Definition: SemaStmt.cpp:4317
TypeResult ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, const CXXScopeSpec &SS, const IdentifierInfo &II, SourceLocation IdLoc, ImplicitTypenameContext IsImplicitTypename=ImplicitTypenameContext::No)
Called when the parser has parsed a C++ typename specifier, e.g., "typename T::type".
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
Definition: SemaStmt.cpp:4019
void ProcessPropertyDecl(ObjCPropertyDecl *property)
Process the specified property declaration and create decls for the setters and getters as needed.
bool isCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind=CompleteTypeKind::Default)
Definition: Sema.h:11900
SemaDiagnosticBuilder targetDiag(SourceLocation Loc, const PartialDiagnostic &PD, const FunctionDecl *FD=nullptr)
Definition: Sema.h:709
void ActOnObjCReenterContainerContext(ObjCContainerDecl *ObjCCtx)
Definition: SemaDecl.cpp:18567
ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc, tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr)
Definition: SemaExpr.cpp:15599
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD, RecordDecl *RD, CapturedRegionKind K, unsigned OpenMPCaptureLevel=0)
Definition: Sema.cpp:2786
bool InstantiateClass(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK, bool Complain=true)
Instantiate the definition of a class from a given pattern.
bool CheckImmediateEscalatingFunctionDefinition(FunctionDecl *FD, const sema::FunctionScopeInfo *FSI)
void emitDeferredDiags()
Definition: Sema.cpp:1905
void setFunctionHasMustTail()
Definition: Sema.cpp:2411
ExprResult BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
bool WarnedStackExhausted
Definition: Sema.h:833
bool hasReachableMemberSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a reachable declaration of D that is a member specialization declaration (as op...
ExprResult CheckExtVectorCast(SourceRange R, QualType DestTy, Expr *CastExpr, CastKind &Kind)
Definition: SemaExpr.cpp:8008
void CodeCompleteObjCInterfaceCategory(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
RecordDecl * CXXTypeInfoDecl
The C++ "type_info" declaration, which is defined in <typeinfo>.
Definition: Sema.h:6652
void InstantiateDefaultCtorDefaultArgs(CXXConstructorDecl *Ctor)
In the MS ABI, we need to instantiate default arguments of dllexported default constructors along wit...
CorrectTypoKind
Definition: Sema.h:7772
@ CTK_NonError
Definition: Sema.h:7773
@ CTK_ErrorRecovery
Definition: Sema.h:7774
void CheckCompleteVariableDeclaration(VarDecl *VD)
Definition: SemaDecl.cpp:14530
bool CanPerformAggregateInitializationForOverloadResolution(const InitializedEntity &Entity, InitListExpr *From)
Determine whether we can perform aggregate initialization for the purposes of overload resolution.
Definition: SemaInit.cpp:3334
ExprResult ActOnRequiresClause(ExprResult ConstraintExpr)
TUFragmentKind
Definition: Sema.h:607
@ Global
The global module fragment, between 'module;' and a module-declaration.
Definition: Sema.h:609
@ Private
The private module fragment, between 'module :private;' and the end of the translation unit.
Definition: Sema.h:616
@ Normal
A normal translation unit fragment.
Definition: Sema.h:613
bool IsOverride(FunctionDecl *MD, FunctionDecl *BaseMD, bool UseMemberUsingDeclRules, bool ConsiderCudaAttrs=true)
SYCLIntelMaxWorkGroupSizeAttr * MergeSYCLIntelMaxWorkGroupSizeAttr(Decl *D, const SYCLIntelMaxWorkGroupSizeAttr &A)
void PopSatisfactionStackEntry()
Definition: Sema.h:11382
void checkClassLevelCodeSegAttribute(CXXRecordDecl *Class)
ExternalSemaSource * getExternalSource() const
Definition: Sema.h:531
QualType BuildPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a pointer type.
Definition: SemaType.cpp:2217
bool isStdInitializerList(QualType Ty, QualType *Element)
Tests whether Ty is an instance of std::initializer_list and, if it is and Element is not NULL,...
DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS, ArrayRef< Decl * > Group)
Definition: SemaDecl.cpp:15056
void setFunctionHasBranchProtectedScope()
Definition: Sema.cpp:2401
RedeclarationKind forRedeclarationInCurContext() const
bool hasReachableDefinition(NamedDecl *D)
Definition: Sema.h:11959
void MergeVarDecl(VarDecl *New, LookupResult &Previous)
MergeVarDecl - We just parsed a variable 'New' which has the same name and scope as a previous declar...
Definition: SemaDecl.cpp:4626
bool AttachTypeConstraint(NestedNameSpecifierLoc NS, DeclarationNameInfo NameInfo, ConceptDecl *NamedConcept, NamedDecl *FoundDecl, const TemplateArgumentListInfo *TemplateArgs, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
Attach a type-constraint to a template parameter.
bool isConstantEvaluatedContext() const
Definition: Sema.h:1865
LazyDeclPtr StdNamespace
The C++ "std" namespace, where the standard library resides.
Definition: Sema.h:4983
StmtResult ActOnFinishSEHFinallyBlock(SourceLocation Loc, Stmt *Block)
Definition: SemaStmt.cpp:4745
ParsedType ActOnMSVCUnknownTypeName(const IdentifierInfo &II, SourceLocation NameLoc, bool IsTemplateTypeArg)
Attempt to behave like MSVC in situations where lookup of an unqualified type name has failed in a de...
Definition: SemaDecl.cpp:593
void AddSYCLAddIRAttributesGlobalVariableAttr(Decl *D, const AttributeCommonInfo &CI, MutableArrayRef< Expr * > Args)
bool DeclareRISCVVBuiltins
Indicate RISC-V vector builtin functions enabled or not.
Definition: Sema.h:13013
void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, FunctionDecl *Function, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given function from its template.
bool CheckUsingDeclRedeclaration(SourceLocation UsingLoc, bool HasTypenameKeyword, const CXXScopeSpec &SS, SourceLocation NameLoc, const LookupResult &Previous)
Checks that the given using declaration is not an invalid redeclaration.
std::pair< const NamedDecl *, llvm::FoldingSetNodeID > SatisfactionStackEntryTy
Definition: Sema.h:11392
bool SubstDefaultArgument(SourceLocation Loc, ParmVarDecl *Param, const MultiLevelTemplateArgumentList &TemplateArgs, bool ForCallExpr=false)
Substitute the given template arguments into the default argument.
StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope)
Definition: SemaStmt.cpp:3379
QualType BuiltinAddPointer(QualType BaseType, SourceLocation Loc)
Definition: SemaType.cpp:10063
void ActOnStartOfTranslationUnit()
This is called before the very first declaration in the translation unit is parsed.
Definition: Sema.cpp:1073
CCEKind
Contexts in which a converted constant expression is required.
Definition: Sema.h:8195
@ CCEK_StaticAssertMessageSize
Call to size() in a static assert message.
Definition: Sema.h:8202
@ CCEK_ExplicitBool
Condition in an explicit(bool) specifier.
Definition: Sema.h:8200
@ CCEK_Noexcept
Condition in a noexcept(bool) specifier.
Definition: Sema.h:8201
@ CCEK_ArrayBound
Array bound in array declarator or new-expression.
Definition: Sema.h:8199
@ CCEK_CaseValue
Expression in a case label.
Definition: Sema.h:8196
@ CCEK_TemplateArg
Value of a non-type template parameter.
Definition: Sema.h:8198
@ CCEK_StaticAssertMessageData
Call to data() in a static assert message.
Definition: Sema.h:8204
@ CCEK_Enumerator
Enumerator value with fixed underlying type.
Definition: Sema.h:8197
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind, ArrayRef< MaterializeTemporaryExpr * > LifetimeExtendTemps={})
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
Definition: SemaStmt.cpp:2775
ObjCInterfaceDecl * ActOnStartClassInterface(Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList, SkipBodyInfo *SkipBody)
ExprResult ActOnCXXAssumeAttr(Stmt *St, const ParsedAttr &A, SourceRange Range)
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
Definition: SemaStmt.cpp:1741
CXXConstructorDecl * LookupCopyingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the copying constructor for the given class.
void ActOnLastBitfield(SourceLocation DeclStart, SmallVectorImpl< Decl * > &AllIvarDecls)
ActOnLastBitfield - This routine handles synthesized bitfields rules for class and class extensions.
Definition: SemaDecl.cpp:19179
void InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
std::pair< StringRef, QualType > CapturedParamNameType
Definition: Sema.h:8854
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
Definition: SemaStmt.cpp:1122
void mergeDeclAttributes(NamedDecl *New, Decl *Old, AvailabilityMergeKind AMK=AMK_Redeclaration)
mergeDeclAttributes - Copy attributes from the Old decl to the New one.
Definition: SemaDecl.cpp:3253
void MarkUnusedFileScopedDecl(const DeclaratorDecl *D)
If it's a file scoped decl that must warn if not used, keep track of it.
Definition: SemaDecl.cpp:1947
ExprResult ActOnInstanceMessage(Scope *S, Expr *Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
llvm::DenseMap< IdentifierInfo *, AsmLabelAttr * > ExtnameUndeclaredIdentifiers
ExtnameUndeclaredIdentifiers - Identifiers contained in #pragma redefine_extname before declared.
Definition: Sema.h:2622
ASTContext & getASTContext() const
Definition: Sema.h:528
void actOnObjCTypeArgsOrProtocolQualifiers(Scope *S, ParsedType baseType, SourceLocation lAngleLoc, ArrayRef< IdentifierInfo * > identifiers, ArrayRef< SourceLocation > identifierLocs, SourceLocation rAngleLoc, SourceLocation &typeArgsLAngleLoc, SmallVectorImpl< ParsedType > &typeArgs, SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc, SmallVectorImpl< Decl * > &protocols, SourceLocation &protocolRAngleLoc, bool warnOnIncompleteProtocols)
Given a list of identifiers (and their locations), resolve the names to either Objective-C protocol q...
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS=nullptr, bool isClassName=false, bool HasTrailingDot=false, ParsedType ObjectType=nullptr, bool IsCtorOrDtorName=false, bool WantNontrivialTypeSourceInfo=false, bool IsClassTemplateDeductionContext=true, ImplicitTypenameContext AllowImplicitTypename=ImplicitTypenameContext::No, IdentifierInfo **CorrectedII=nullptr)
If the identifier refers to a type name within this scope, return the declaration of that type.
Definition: SemaDecl.cpp:291
ExprResult SubstConstraintExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
EnumConstantDecl * CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, SourceLocation IdLoc, IdentifierInfo *Id, Expr *val)
Definition: SemaDecl.cpp:19970
bool CheckTemplateArgumentList(TemplateDecl *Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs, SmallVectorImpl< TemplateArgument > &SugaredConverted, SmallVectorImpl< TemplateArgument > &CanonicalConverted, bool UpdateArgsWithConversions=true, bool *ConstraintsNotSatisfied=nullptr)
Check that the given template arguments can be provided to the given template, converting the argumen...
TypeResult actOnObjCProtocolQualifierType(SourceLocation lAngleLoc, ArrayRef< Decl * > protocols, ArrayRef< SourceLocation > protocolLocs, SourceLocation rAngleLoc)
Build a an Objective-C protocol-qualified 'id' type where no base type was specified.
Definition: SemaType.cpp:1126
bool CheckForConstantInitializer(Expr *Init, unsigned DiagID=diag::err_init_element_not_constant)
type checking declaration initializers (C99 6.7.8)
Definition: SemaDecl.cpp:12779
ASTConsumer & Consumer
Definition: Sema.h:860
void DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *CDecl, bool SynthesizeProperties)
DiagnoseUnimplementedProperties - This routine warns on those properties which must be implemented by...
bool handlerCanCatch(QualType HandlerType, QualType ExceptionType)
RequiresExprBodyDecl * ActOnStartRequiresExpr(SourceLocation RequiresKWLoc, ArrayRef< ParmVarDecl * > LocalParameters, Scope *BodyScope)
void AddFunctionCandidates(const UnresolvedSetImpl &Functions, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, bool SuppressUserConversions=false, bool PartialOverloading=false, bool FirstArgumentIsBase=false)
Add all of the function declarations in the given function set to the overload candidate set.
void ActOnFinishCXXMemberDecls()
Perform any semantic analysis which needs to be delayed until all pending class member declarations h...
llvm::SmallPtrSet< const Decl *, 4 > ParsingInitForAutoVars
ParsingInitForAutoVars - a set of declarations with auto types for which we are currently parsing the...
Definition: Sema.h:3432
ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc, SourceLocation EncodeLoc, SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc)
OverloadKind
Definition: Sema.h:8092
@ Ovl_NonFunction
This is not an overload because the lookup results contain a non-function.
Definition: Sema.h:8103
@ Ovl_Overload
This is a legitimate overload: the existing declarations are functions or function templates with dif...
Definition: Sema.h:8095
@ Ovl_Match
This is not an overload because the signature exactly matches an existing declaration.
Definition: Sema.h:8099
bool checkTargetAttr(SourceLocation LiteralLoc, StringRef Str)
PragmaAlignPackDiagnoseKind
Definition: Sema.h:1556
bool CheckPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess, bool Diagnose=true)
CheckPointerConversion - Check the pointer conversion from the expression From to the type ToType.
SmallVector< ExprWithCleanups::CleanupObject, 8 > ExprCleanupObjects
ExprCleanupObjects - This is the stack of objects requiring cleanup that are created by the current f...
Definition: Sema.h:5361
void CodeCompleteObjCMethodDecl(Scope *S, std::optional< bool > IsInstanceMethod, ParsedType ReturnType)
void NoteDeletedFunction(FunctionDecl *FD)
Emit a note explaining that this function is deleted.
Definition: SemaExpr.cpp:120
void DiagnoseUnusedNestedTypedefs(const RecordDecl *D)
Definition: SemaDecl.cpp:2104
sema::AnalysisBasedWarnings AnalysisWarnings
Worker object for performing CFG-based warnings.
Definition: Sema.h:898
bool hasUncompilableErrorOccurred() const
Whether uncompilable error has occurred.
Definition: Sema.cpp:1664
AlwaysInlineAttr * mergeAlwaysInlineAttr(Decl *D, const AttributeCommonInfo &CI, const IdentifierInfo *Ident)
std::deque< PendingImplicitInstantiation > PendingInstantiations
The queue of implicit template instantiations that are required but have not yet been performed.
Definition: Sema.h:10706
ExprResult CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
Definition: SemaExpr.cpp:5417
void addAMDGPUFlatWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size attribute to a particular declar...
ExprResult BuiltinShuffleVector(CallExpr *TheCall)
BuiltinShuffleVector - Handle __builtin_shufflevector.
bool CheckImplicitNullabilityTypeSpecifier(QualType &Type, NullabilityKind Nullability, SourceLocation DiagLoc, bool AllowArrayTypes, bool OverrideExisting)
Check whether a nullability type specifier can be added to the given type through some means not writ...
Definition: SemaType.cpp:7836
Decl * ActOnFinishLinkageSpecification(Scope *S, Decl *LinkageSpec, SourceLocation RBraceLoc)
ActOnFinishLinkageSpecification - Complete the definition of the C++ linkage specification LinkageSpe...
ModuleImportState
An enumeration to represent the transition of states in parsing module fragments and imports.
Definition: Sema.h:7935
void CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS, bool IsParameter)
void NoteAllOverloadCandidates(Expr *E, QualType DestType=QualType(), bool TakingAddress=false)
bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, const ObjCMethodDecl *PrevMethod, MethodMatchStrategy strategy=MMS_strict)
MatchTwoMethodDeclarations - Checks if two methods' type match and returns true, or false,...
void MarkUsedTemplateParameters(const Expr *E, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used)
Mark which template parameters are used in a given expression.
static QualType getPrintable(QualType T)
Definition: Sema.h:11638
ExprResult ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind)
Definition: SemaExpr.cpp:3852
void CodeCompleteConstructorInitializer(Decl *Constructor, ArrayRef< CXXCtorInitializer * > Initializers)
QualType GetSignedVectorType(QualType V)
Definition: SemaExpr.cpp:13089
ModuleLoader & getModuleLoader() const
Retrieve the module loader associated with the preprocessor.
Definition: Sema.cpp:67
StmtResult ActOnMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, CXXScopeSpec &SS, UnqualifiedId &Name, Stmt *Nested)
Definition: SemaStmt.cpp:4775
AccessResult CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E, DeclAccessPair FoundDecl)
void incrementMSManglingNumber() const
Definition: Sema.h:835
bool CheckDistantExceptionSpec(QualType T)
CheckDistantExceptionSpec - Check if the given type is a pointer or pointer to member to a function w...
bool isAcceptableNestedNameSpecifier(const NamedDecl *SD, bool *CanCorrect=nullptr)
Determines whether the given declaration is an valid acceptable result for name lookup of a nested-na...
DeclResult ActOnExplicitInstantiation(Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc, unsigned TagSpec, SourceLocation KWLoc, const CXXScopeSpec &SS, TemplateTy Template, SourceLocation TemplateNameLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, const ParsedAttributesView &Attr)
bool CheckInheritingConstructorUsingDecl(UsingDecl *UD)
Additional checks for a using declaration referring to a constructor name.
void AddNonMemberOperatorCandidates(const UnresolvedSetImpl &Functions, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr)
Add all of the non-member operator function declarations in the given function set to the overload ca...
ObjCIvarDecl * GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method, const ObjCPropertyDecl *&PDecl) const
GetIvarBackingPropertyAccessor - If method is a property setter/getter and it property has a backing ...
QualType CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc)
Note that LHS is not null here, even if this is the gnu "x ?: y" extension.
Definition: SemaExpr.cpp:8714
void AddKnownFunctionAttributesForReplaceableGlobalAllocationFunction(FunctionDecl *FD)
If this function is a C++ replaceable global allocation function (C++2a [basic.stc....
Definition: SemaDecl.cpp:16794
void ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl, bool IncompleteImpl=false)
ImplMethodsVsClassMethods - This is main routine to warn if any method remains unimplemented in the c...
bool inferObjCARCLifetime(ValueDecl *decl)
Definition: SemaDecl.cpp:7040
ExpressionEvaluationContext
Describes how the expressions currently being parsed are evaluated at run-time, if at all.
Definition: Sema.h:5133
@ UnevaluatedAbstract
The current expression occurs within an unevaluated operand that unconditionally permits abstract ref...
@ UnevaluatedList
The current expression occurs within a braced-init-list within an unevaluated operand.
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ DiscardedStatement
The current expression occurs within a discarded statement.
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
@ PotentiallyEvaluatedIfUsed
The current expression is potentially evaluated, but any declarations referenced inside that expressi...
void CodeCompleteObjCClassMessage(Scope *S, ParsedType Receiver, ArrayRef< const IdentifierInfo * > SelIdents, bool AtArgumentExpression, bool IsSuper=false)
void addAMDGPUMaxNumWorkGroupsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *XExpr, Expr *YExpr, Expr *ZExpr)
addAMDGPUMaxNumWorkGroupsAttr - Adds an amdgpu_max_num_work_groups attribute to a particular declarat...
void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType, bool IsDereference, SourceRange Range)
Definition: SemaCast.cpp:2044
QualType BuildDecltypeType(Expr *E, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
Definition: SemaType.cpp:9968
unsigned LastEmittedCodeSynthesisContextDepth
The depth of the context stack at the point when the most recent error or warning was produced.
Definition: Sema.h:10476
ExprResult BuildDependentDeclRefExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
QualType BuildUnaryTransformType(QualType BaseType, UTTKind UKind, SourceLocation Loc)
Definition: SemaType.cpp:10227
AvailabilityPriority
Describes the kind of priority given to an availability attribute.
Definition: Sema.h:3564
@ AP_PragmaClangAttribute
The availability attribute was applied using '#pragma clang attribute'.
Definition: Sema.h:3570
@ AP_InferredFromOtherPlatform
The availability attribute for a specific platform was inferred from an availability attribute for an...
Definition: Sema.h:3574
@ AP_Explicit
The availability attribute was specified explicitly next to the declaration.
Definition: Sema.h:3567
AvailabilityMergeKind
Describes the kind of merge to perform for availability attributes (including "deprecated",...
Definition: Sema.h:3354
@ AMK_None
Don't merge availability attributes at all.
Definition: Sema.h:3356
@ AMK_Override
Merge availability attributes for an override, which requires an exact match or a weakening of constr...
Definition: Sema.h:3362
@ AMK_ProtocolImplementation
Merge availability attributes for an implementation of a protocol requirement.
Definition: Sema.h:3365
@ AMK_OptionalProtocolImplementation
Merge availability attributes for an implementation of an optional protocol requirement.
Definition: Sema.h:3368
@ AMK_Redeclaration
Merge availability attributes for a redeclaration, which requires an exact match.
Definition: Sema.h:3359
void ActOnDocumentableDecls(ArrayRef< Decl * > Group)
Definition: SemaDecl.cpp:15177
ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_astype(...)
Definition: SemaExpr.cpp:6944
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
Definition: SemaStmt.cpp:4725
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
Definition: SemaExpr.cpp:4910
TypeSourceInfo * GetTypeForDeclarator(Declarator &D)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
Definition: SemaType.cpp:6148
void CheckStaticLocalForDllExport(VarDecl *VD)
Check if VD needs to be dllexport/dllimport due to being in a dllexport/import function.
Definition: SemaDecl.cpp:14842
ExprResult BuildOperatorCoawaitLookupExpr(Scope *S, SourceLocation Loc)
std::pair< SourceLocation, bool > DeleteExprLoc
Definition: Sema.h:571
void diagnoseTypo(const TypoCorrection &Correction, const PartialDiagnostic &TypoDiag, bool ErrorRecovery=true)
bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc, CallExpr *CE, FunctionDecl *FD)
CheckCallReturnType - Checks that a call expression's return type is complete.
Definition: SemaExpr.cpp:20577
bool CheckUnaryExprOrTypeTraitOperand(Expr *E, UnaryExprOrTypeTrait ExprKind)
Check the constraints on expression operands to unary type expression and type traits.
Definition: SemaExpr.cpp:4517
DeclResult ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, AccessSpecifier AS, SourceLocation ModulePrivateLoc, MultiTemplateParamsArg TemplateParameterLists, bool &OwnedDecl, bool &IsDependent, SourceLocation ScopedEnumKWLoc, bool ScopedEnumUsesClassTag, TypeResult UnderlyingType, bool IsTypeSpecifier, bool IsTemplateParamOrArg, OffsetOfKind OOK, SkipBodyInfo *SkipBody=nullptr)
This is invoked when we see 'struct foo' or 'struct {'.
Definition: SemaDecl.cpp:17426
Decl * ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS, const ParsedAttributesView &DeclAttrs, RecordDecl *&AnonRecord)
ParsedFreeStandingDeclSpec - This method is invoked when a declspec with no declarator (e....
Definition: SemaDecl.cpp:4945
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, SmallVectorImpl< TemplateArgument > &SugaredConverted, SmallVectorImpl< TemplateArgument > &CanonicalConverted, CheckTemplateArgumentKind CTAK)
Check that the given template argument corresponds to the given template parameter.
void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method)
Add the given method to the list of globally-known methods.
void CodeCompleteModuleImport(SourceLocation ImportLoc, ModuleIdPath Path)
void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace)
ActOnFinishNamespaceDef - This callback is called after a namespace is exited.
void CodeCompletePreprocessorMacroName(bool IsDefinition)
NestedNameSpecifierLoc SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, const MultiLevelTemplateArgumentList &TemplateArgs)
void RecordParsingTemplateParameterDepth(unsigned Depth)
This is used to inform Sema what the current TemplateParameterDepth is during Parsing.
Definition: Sema.cpp:2251
ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty, SourceLocation RPLoc)
Definition: SemaExpr.cpp:16828
MemInitResult BuildMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, const DeclSpec &DS, SourceLocation IdLoc, Expr *Init, SourceLocation EllipsisLoc)
Handle a C++ member initializer.
void ActOnAfterCompoundStatementLeadingPragmas()
Definition: SemaStmt.cpp:399
TypeSourceInfo * GetTypeForDeclaratorCast(Declarator &D, QualType FromTy)
Definition: SemaType.cpp:6261
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
Definition: SemaStmt.cpp:79
SmallVector< Decl *, 2 > WeakTopLevelDecl
WeakTopLevelDecl - Translation-unit scoped declarations generated by #pragma weak during processing o...
Definition: Sema.h:3591
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
Definition: SemaType.cpp:9368
void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D, SourceLocation LocAfterDecls)
Definition: SemaDecl.cpp:15552
void DiagnoseUseOfUnimplementedSelectors()
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
Definition: Sema.h:831
ReferenceCompareResult CompareReferenceRelationship(SourceLocation Loc, QualType T1, QualType T2, ReferenceConversions *Conv=nullptr)
CompareReferenceRelationship - Compare the two types T1 and T2 to determine whether they are referenc...
void ActOnTagFinishSkippedDefinition(SkippedDefinitionContext Context)
Definition: SemaDecl.cpp:1357
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
Definition: SemaInternal.h:24
void DiagnoseUnterminatedPragmaAttribute()
Definition: SemaAttr.cpp:1145
void FreeVisContext()
FreeVisContext - Deallocate and null out VisContext.
Definition: SemaAttr.cpp:1251
bool SatisfactionStackContains(const NamedDecl *D, const llvm::FoldingSetNodeID &ID) const
Definition: Sema.h:11384
ExprResult forceUnknownAnyToType(Expr *E, QualType ToType)
Force an expression with unknown-type to an expression of the given type.
Definition: SemaExpr.cpp:21221
void CodeCompleteOrdinaryName(Scope *S, ParserCompletionContext CompletionContext)
LateTemplateParserCB * LateTemplateParser
Definition: Sema.h:904
void DiagnoseAmbiguousLookup(LookupResult &Result)
Produce a diagnostic describing the ambiguity that resulted from name lookup.
void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl, ArrayRef< Decl * > Fields, SourceLocation LBrac, SourceLocation RBrac, const ParsedAttributesView &AttrList)
Definition: SemaDecl.cpp:19425
void CheckExplicitObjectLambda(Declarator &D)
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
void NoteDeletedInheritingConstructor(CXXConstructorDecl *CD)
QualType getCapturedDeclRefType(ValueDecl *Var, SourceLocation Loc)
Given a variable, determine the type that a reference to that variable will have in the given scope.
Definition: SemaExpr.cpp:19566
ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc, Declarator &D, ParsedType &Ty, SourceLocation RParenLoc, Expr *CastExpr)
Definition: SemaExpr.cpp:8043
void ModifyFnAttributesMSPragmaOptimize(FunctionDecl *FD)
Only called on function definitions; if there is a MSVC #pragma optimize in scope,...
Definition: SemaAttr.cpp:1200
SectionAttr * mergeSectionAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Name)
void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc)
PopPragmaVisibility - Pop the top element of the visibility stack; used for '#pragma GCC visibility' ...
Definition: SemaAttr.cpp:1389
llvm::MapVector< FieldDecl *, DeleteLocs > DeleteExprs
Delete-expressions to be analyzed at the end of translation unit.
Definition: Sema.h:6663
bool shouldLinkDependentDeclWithPrevious(Decl *D, Decl *OldDecl)
Checks if the new declaration declared in dependent context must be put in the same redeclaration cha...
Definition: SemaDecl.cpp:11253
TentativeDefinitionsType TentativeDefinitions
All the tentative definitions encountered in the TU.
Definition: Sema.h:2641
ObjCPropertyDecl * CreatePropertyDecl(Scope *S, ObjCContainerDecl *CDecl, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc, Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite, const unsigned Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
Called by ActOnProperty and HandlePropertyInClassExtension to handle creating the ObjcPropertyDecl fo...
void CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS)
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
void CodeCompleteObjCPropertyGetter(Scope *S)
bool DeferDiags
Whether deferrable diagnostics should be deferred.
Definition: Sema.h:8071
void checkInitializerLifetime(const InitializedEntity &Entity, Expr *Init)
Check that the lifetime of the initializer (and its subobjects) is sufficient for initializing the en...
Definition: SemaInit.cpp:8137
QualType getLambdaConversionFunctionResultType(const FunctionProtoType *CallOpType, CallingConv CC)
Get the return type to use for a lambda's conversion function(s) to function pointer type,...
IdentifierInfo * getNSErrorIdent()
Retrieve the identifier "NSError".
Definition: SemaType.cpp:4278
bool RebuildingImmediateInvocation
Whether the AST is currently being rebuilt to correct immediate invocations.
Definition: Sema.h:6446
DarwinSDKInfo * getDarwinSDKInfoForAvailabilityChecking()
Definition: Sema.cpp:81
void DiagnoseAvailabilityOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass, bool ObjCPropertyAccess, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReceiver=nullptr)
ResultTypeCompatibilityKind
Describes the compatibility of a result type with its method.
Definition: Sema.h:12202
@ RTC_Incompatible
Definition: Sema.h:12204
@ RTC_Compatible
Definition: Sema.h:12203
@ RTC_Unknown
Definition: Sema.h:12205
const llvm::MapVector< FieldDecl *, DeleteLocs > & getMismatchingDeleteExpressions() const
Retrieves list of suspicious delete-expressions that will be checked at the end of translation unit.
Definition: Sema.cpp:2808
FPOptions & getCurFPFeatures()
Definition: Sema.h:523
void CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record)
Perform semantic checks on a class definition that has been completing, introducing implicitly-declar...
void DiscardCleanupsInEvaluationContext()
Definition: SemaExpr.cpp:18243
ArrayRef< InventedTemplateParameterInfo > getInventedParameterInfos() const
Definition: Sema.h:9001
void ReadMethodPool(Selector Sel)
Read the contents of the method pool for a given selector from external storage.
QualType BuiltinRemoveExtent(QualType BaseType, UTTKind UKind, SourceLocation Loc)
Definition: SemaType.cpp:10108
bool NeedToCaptureVariable(ValueDecl *Var, SourceLocation Loc)
Checks if the variable must be captured.
Definition: SemaExpr.cpp:19558
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
Definition: Sema.h:6607
void CodeCompleteObjCSelector(Scope *S, ArrayRef< const IdentifierInfo * > SelIdents)
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
Definition: SemaDecl.cpp:1329
bool CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New)
bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty, CastKind &Kind)
Definition: SemaExpr.cpp:7955
bool LookupTemplateName(LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType, bool EnteringContext, bool &MemberOfUnknownSpecialization, RequiredTemplateKind RequiredTemplate=SourceLocation(), AssumedTemplateKind *ATK=nullptr, bool AllowTypoCorrection=true)
void makeMergedDefinitionVisible(NamedDecl *ND)
Make a merged definition of an existing hidden definition ND visible at the specified location.
void makeModuleVisible(Module *Mod, SourceLocation ImportLoc)
Definition: Sema.h:7921
QualType getCompletedType(Expr *E)
Get the type of expression E, triggering instantiation to complete the type if necessary – that is,...
Definition: SemaType.cpp:9309
StmtResult ActOnAttributedStmt(const ParsedAttributes &AttrList, Stmt *SubStmt)
Definition: SemaStmt.cpp:624
QualType BuiltinChangeCVRQualifiers(QualType BaseType, UTTKind UKind, SourceLocation Loc)
Definition: SemaType.cpp:10134
bool isDependentScopeSpecifier(const CXXScopeSpec &SS)
SourceManager & SourceMgr
Definition: Sema.h:862
MemberExpr * BuildMemberExpr(Expr *Base, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec *SS, SourceLocation TemplateKWLoc, ValueDecl *Member, DeclAccessPair FoundDecl, bool HadMultipleCandidates, const DeclarationNameInfo &MemberNameInfo, QualType Ty, ExprValueKind VK, ExprObjectKind OK, const TemplateArgumentListInfo *TemplateArgs=nullptr)
TemplateNameIsRequiredTag
Definition: Sema.h:9045
@ TemplateNameIsRequired
Definition: Sema.h:9045
bool CheckDestructor(CXXDestructorDecl *Destructor)
CheckDestructor - Checks a fully-formed destructor definition for well-formedness,...
bool CheckAlignasTypeArgument(StringRef KWName, TypeSourceInfo *TInfo, SourceLocation OpLoc, SourceRange R)
Definition: SemaExpr.cpp:5001
SwiftNameAttr * mergeSwiftNameAttr(Decl *D, const SwiftNameAttr &SNA, StringRef Name)
ExprResult BuildVectorLiteral(SourceLocation LParenLoc, SourceLocation RParenLoc, Expr *E, TypeSourceInfo *TInfo)
Build an altivec or OpenCL literal.
Definition: SemaExpr.cpp:8116
NamedDecl * BuildUsingPackDecl(NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > Expansions)
MemInitResult ActOnMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, const DeclSpec &DS, SourceLocation IdLoc, SourceLocation LParenLoc, ArrayRef< Expr * > Args, SourceLocation RParenLoc, SourceLocation EllipsisLoc)
Handle a C++ member initializer using parentheses syntax.
void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc, StringLiteral *Message=nullptr)
ExprResult ActOnSizeofParameterPackExpr(Scope *S, SourceLocation OpLoc, IdentifierInfo &Name, SourceLocation NameLoc, SourceLocation RParenLoc)
Called when an expression computing the size of a parameter pack is parsed.
void checkRetainCycles(ObjCMessageExpr *msg)
checkRetainCycles - Check whether an Objective-C message send might create an obvious retain cycle.
bool isUnavailableAlignedAllocationFunction(const FunctionDecl &FD) const
Determine whether FD is an aligned allocation or deallocation function that is unavailable.
bool hasReachableExplicitSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a reachable declaration of D that is an explicit specialization declaration for...
bool CheckMaxAllowedWorkGroupSize(const Expr *RWGSXDim, const Expr *RWGSYDim, const Expr *RWGSZDim, const Expr *MWGSXDim, const Expr *MWGSYDim, const Expr *MWGSZDim)
Decl * BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, RecordDecl *Record)
BuildMicrosoftCAnonymousStruct - Handle the declaration of an Microsoft C anonymous structure.
Definition: SemaDecl.cpp:5913
bool isDeductionGuideName(Scope *S, const IdentifierInfo &Name, SourceLocation NameLoc, CXXScopeSpec &SS, ParsedTemplateTy *Template=nullptr)
Determine whether a particular identifier might be the name in a C++1z deduction-guide declaration.
ASTConsumer & getASTConsumer() const
Definition: Sema.h:529
TypeSourceInfo * SubstAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto, QualType Replacement)
Substitute Replacement for auto in TypeWithAuto.
void ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action, StringRef SlotLabel, Expr *Alignment)
ActOnPragmaPack - Called on well formed #pragma pack(...).
Definition: SemaAttr.cpp:334
static bool CanBeGetReturnTypeOnAllocFailure(const FunctionDecl *FD)
Definition: SemaDecl.cpp:16182
void ActOnStartDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnStartDelayedCXXMethodDeclaration - We have completed parsing a top-level (non-nested) C++ class,...
LazyVector< CXXConstructorDecl *, ExternalSemaSource, &ExternalSemaSource::ReadDelegatingConstructors, 2, 2 > DelegatingCtorDeclsType
Definition: Sema.h:4976
LabelDecl * GetOrCreateMSAsmLabel(StringRef ExternalLabelName, SourceLocation Location, bool AlwaysCreate)
bool DiagnoseDependentMemberLookup(const LookupResult &R)
Diagnose a lookup that found results in an enclosing class during error recovery.
Definition: SemaExpr.cpp:2482
std::function< ExprResult(Sema &, TypoExpr *, TypoCorrection)> TypoRecoveryCallback
Definition: Sema.h:7622
DiagnosticsEngine & Diags
Definition: Sema.h:861
void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, bool AllowNonIdentifiers, bool AllowNestedNameSpecifiers)
CXXMethodDecl * CreateLambdaCallOperator(SourceRange IntroducerRange, CXXRecordDecl *Class)
Definition: SemaLambda.cpp:932
void DiagnoseUnterminatedPragmaAlignPack()
Definition: SemaAttr.cpp:487
StmtResult ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope)
Definition: SemaStmt.cpp:3406
FullExprArg MakeFullDiscardedValueExpr(Expr *Arg)
Definition: Sema.h:6017
FPOptions CurFPFeatures
Definition: Sema.h:855
void ActOnStartSEHFinallyBlock()
Definition: SemaStmt.cpp:4737
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
CXXConstructorDecl * DeclareImplicitCopyConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit copy constructor for the given class.
static bool CanBeGetReturnObject(const FunctionDecl *FD)
Definition: SemaDecl.cpp:16178
void ActOnPragmaMSAllocText(SourceLocation PragmaLocation, StringRef Section, const SmallVector< std::tuple< IdentifierInfo *, SourceLocation >> &Functions)
Called on well-formed #pragma alloc_text().
Definition: SemaAttr.cpp:799
NamespaceDecl * getStdNamespace() const
QualType BuiltinRemovePointer(QualType BaseType, SourceLocation Loc)
Definition: SemaType.cpp:10072
llvm::SmallPtrSet< const CXXRecordDecl *, 8 > RecordDeclSetTy
Definition: Sema.h:4967
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
void DeclareImplicitEqualityComparison(CXXRecordDecl *RD, FunctionDecl *Spaceship)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
QualType AdjustParameterTypeForObjCAutoRefCount(QualType T, SourceLocation NameLoc, TypeSourceInfo *TSInfo)
Definition: SemaDecl.cpp:15436
bool AttachBaseSpecifiers(CXXRecordDecl *Class, MutableArrayRef< CXXBaseSpecifier * > Bases)
Performs the actual work of attaching the given base class specifiers to a C++ class.
void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl)
ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an initializer for the declaratio...
NamedDecl * ActOnTypedefDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous)
Definition: SemaDecl.cpp:6839
void CodeCompleteAfterFunctionEquals(Declarator &D)
QualType BuildArrayType(QualType T, ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity)
Build an array type.
Definition: SemaType.cpp:2517
bool CheckAttrTarget(const ParsedAttr &CurrAttr)
ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose=true)
DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).
Definition: SemaExpr.cpp:595
PragmaStack< StringLiteral * > DataSegStack
Definition: Sema.h:1411
void deduceClosureReturnType(sema::CapturingScopeInfo &CSI)
Deduce a block or lambda's return type based on the return statements present in the body.
Definition: SemaLambda.cpp:650
LateTemplateParserCleanupCB * LateTemplateParserCleanup
Definition: Sema.h:905
void AddSYCLIntelESimdVectorizeAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType)
Are the two types lax-compatible vector types? That is, given that one of them is a vector,...
Definition: SemaExpr.cpp:7890
SYCLIntelMaxWorkGroupsPerMultiprocessorAttr * MergeSYCLIntelMaxWorkGroupsPerMultiprocessorAttr(Decl *D, const SYCLIntelMaxWorkGroupsPerMultiprocessorAttr &A)
NamedDecl * ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, unsigned Depth, unsigned Position, SourceLocation EqualLoc, Expr *DefaultArg)
bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD, ObjCMethodDecl *Getter, SourceLocation Loc)
@ TUK_Definition
Definition: Sema.h:3192
@ TUK_Declaration
Definition: Sema.h:3191
@ TUK_Friend
Definition: Sema.h:3193
@ TUK_Reference
Definition: Sema.h:3190
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
Definition: SemaInit.cpp:10673
static bool adjustContextForLocalExternDecl(DeclContext *&DC)
Adjust the DeclContext for a function or variable that might be a function-local external declaration...
Definition: SemaDecl.cpp:7457
void diagnoseMissingTemplateArguments(TemplateName Name, SourceLocation Loc)
void CheckFunctionOrTemplateParamDeclarator(Scope *S, Declarator &D)
Common checks for a parameter-declaration that should apply to both function parameters and non-type ...
Definition: SemaDecl.cpp:15210
ExprResult ActOnTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< ParsedType > Args, SourceLocation RParenLoc)
Parsed one of the type trait support pseudo-functions.
TemplateParamListContext
The context in which we are checking a template parameter list.
Definition: Sema.h:9196
@ TPC_ClassTemplate
Definition: Sema.h:9197
@ TPC_FriendFunctionTemplate
Definition: Sema.h:9202
@ TPC_ClassTemplateMember
Definition: Sema.h:9200
@ TPC_FunctionTemplate
Definition: Sema.h:9199
@ TPC_FriendClassTemplate
Definition: Sema.h:9201
@ TPC_FriendFunctionTemplateDefinition
Definition: Sema.h:9203
@ TPC_TypeAliasTemplate
Definition: Sema.h:9204
@ TPC_VarTemplate
Definition: Sema.h:9198
void ActOnPragmaVisibility(const IdentifierInfo *VisType, SourceLocation PragmaLoc)
ActOnPragmaVisibility - Called on well formed #pragma GCC visibility... .
Definition: SemaAttr.cpp:1265
void ActOnAbortSEHFinallyBlock()
Definition: SemaStmt.cpp:4741
SpecialMemberOverloadResult LookupSpecialMember(CXXRecordDecl *D, CXXSpecialMemberKind SM, bool ConstArg, bool VolatileArg, bool RValueThis, bool ConstThis, bool VolatileThis)
NamedDecl * ActOnTypedefNameDecl(Scope *S, DeclContext *DC, TypedefNameDecl *D, LookupResult &Previous, bool &Redeclaration)
ActOnTypedefNameDecl - Perform semantic checking for a declaration which declares a typedef-name,...
Definition: SemaDecl.cpp:6926
void ActOnFinishDelayedAttribute(Scope *S, Decl *D, ParsedAttributes &Attrs)
ActOnFinishDelayedAttribute - Invoked when we have finished parsing an attribute for which parsing is...
Definition: SemaDecl.cpp:16641
bool CheckQualifiedFunctionForTypeId(QualType T, SourceLocation Loc)
Definition: SemaType.cpp:2183
SmallVector< LateInstantiatedAttribute, 16 > LateInstantiatedAttrVec
Definition: Sema.h:10828
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
Definition: SemaExpr.cpp:5849
Decl * ActOnEmptyDeclaration(Scope *S, const ParsedAttributesView &AttrList, SourceLocation SemiLoc)
Handle a C++11 empty-declaration and attribute-declaration.
void CodeCompleteObjCAtStatement(Scope *S)
void DiagnoseAssignmentAsCondition(Expr *E)
DiagnoseAssignmentAsCondition - Given that an expression is being used as a boolean condition,...
Definition: SemaExpr.cpp:20620
llvm::SmallPtrSet< Selector, 8 > SelectorSet
Definition: Sema.h:12049
SourceLocation OptimizeOffPragmaLocation
This represents the last location of a "#pragma clang optimize off" directive if such a directive has...
Definition: Sema.h:1487
void checkSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec)
We've found a use of a templated declaration that would trigger an implicit instantiation.
void DiagnoseUnusedDecl(const NamedDecl *ND)
Definition: SemaDecl.cpp:2122
void handleDelayedAvailabilityCheck(sema::DelayedDiagnostic &DD, Decl *Ctx)
friend class ArgumentPackSubstitutionRAII
Definition: Sema.h:10513
bool hasAcceptableDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules, Sema::AcceptableKind Kind)
Determine if the template parameter D has a reachable default argument.
QualType BuildReadPipeType(QualType T, SourceLocation Loc)
Build a Read-only Pipe type.
Definition: SemaType.cpp:2365
void EmitRelatedResultTypeNote(const Expr *E)
If the given expression involves a message send to a method with a related result type,...
void PopDeclContext()
Definition: SemaDecl.cpp:1336
DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, ArrayRef< IdentifierLocPair > IdentList, const ParsedAttributesView &attrList)
ActOnForwardProtocolDeclaration - Handle @protocol foo;.
void CodeCompleteObjCInterfaceDecl(Scope *S)
bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS)
ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global scope or nested-name-specifi...
ObjCMethodDecl * tryCaptureObjCSelf(SourceLocation Loc)
Try to capture an implicit reference to 'self'.
TemplateArgumentLoc getIdentityTemplateArgumentLoc(NamedDecl *Param, SourceLocation Location)
Get a template argument mapping the given template parameter to itself, e.g.
bool CheckIfFunctionSpecializationIsImmediate(FunctionDecl *FD, SourceLocation Loc)
bool isObjCWritebackConversion(QualType FromType, QualType ToType, QualType &ConvertedType)
Determine whether this is an Objective-C writeback conversion, used for parameter passing when perfor...
void diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals, SourceLocation FallbackLoc, SourceLocation ConstQualLoc=SourceLocation(), SourceLocation VolatileQualLoc=SourceLocation(), SourceLocation RestrictQualLoc=SourceLocation(), SourceLocation AtomicQualLoc=SourceLocation(), SourceLocation UnalignedQualLoc=SourceLocation())
Definition: SemaType.cpp:3357
AccessResult CheckMemberAccess(SourceLocation UseLoc, CXXRecordDecl *NamingClass, DeclAccessPair Found)
Checks access to a member.
void DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID, ObjCInterfaceDecl *SID)
DiagnoseDuplicateIvars - Check for duplicate ivars in the entire class at the start of @implementatio...
QualType CheckBitwiseOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
Definition: SemaExpr.cpp:13494
concepts::NestedRequirement * BuildNestedRequirement(Expr *E)
llvm::MapVector< NamedDecl *, SourceLocation > UndefinedButUsed
UndefinedInternals - all the used, undefined objects which require a definition in this translation u...
Definition: Sema.h:4995
SmallVector< Module *, 16 > CodeSynthesisContextLookupModules
Extra modules inspected when performing a lookup during a template instantiation.
Definition: Sema.h:10443
void PrintStats() const
Print out statistics about the semantic analysis.
Definition: Sema.cpp:601
ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc)
Definition: SemaExpr.cpp:16177
bool ResolveAndFixSingleFunctionTemplateSpecialization(ExprResult &SrcExpr, bool DoFunctionPointerConversion=false, bool Complain=false, SourceRange OpRangeForComplaining=SourceRange(), QualType DestTypeForComplaining=QualType(), unsigned DiagIDForComplaining=0)
bool CheckObjCDeclScope(Decl *D)
Checks that the Objective-C declaration is declared in the global scope.
QualType CheckConstructorDeclarator(Declarator &D, QualType R, StorageClass &SC)
CheckConstructorDeclarator - Called by ActOnDeclarator to check the well-formedness of the constructo...
ExprResult ConvertParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg, SourceLocation EqualLoc)
void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, bool IsPackExpansion)
AddAlignedAttr - Adds an aligned attribute to a particular declaration.
SYCLUsesAspectsAttr * MergeSYCLUsesAspectsAttr(Decl *D, const SYCLUsesAspectsAttr &A)
void getUndefinedButUsed(SmallVectorImpl< std::pair< NamedDecl *, SourceLocation >> &Undefined)
Obtain a sorted list of functions that are undefined but ODR-used.
Definition: Sema.cpp:851
static unsigned getPrintable(unsigned I)
Definition: Sema.h:11629
void checkVariadicArgument(const Expr *E, VariadicCallType CT)
Check to see if the given expression is a valid argument to a variadic function, issuing a diagnostic...
Definition: SemaExpr.cpp:1067
ExprResult ActOnCXXFoldExpr(Scope *S, SourceLocation LParenLoc, Expr *LHS, tok::TokenKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc)
Handle a C++1z fold-expression: ( expr op ... op expr ).
void CheckStaticArrayArgument(SourceLocation CallLoc, ParmVarDecl *Param, const Expr *ArgExpr)
CheckStaticArrayArgument - If the given argument corresponds to a static array parameter,...
Definition: SemaExpr.cpp:6321
FormatStringType
Definition: Sema.h:1896
@ FST_NSString
Definition: Sema.h:1899
@ FST_Unknown
Definition: Sema.h:1906
@ FST_Strftime
Definition: Sema.h:1900
@ FST_Printf
Definition: Sema.h:1898
@ FST_FreeBSDKPrintf
Definition: Sema.h:1903
@ FST_Scanf
Definition: Sema.h:1897
@ FST_Strfmon
Definition: Sema.h:1901
@ FST_OSLog
Definition: Sema.h:1905
@ FST_Kprintf
Definition: Sema.h:1902
@ FST_OSTrace
Definition: Sema.h:1904
LangOptions::PragmaMSPointersToMembersKind MSPointerToMemberRepresentationMethod
Controls member pointer representation format under the MS ABI.
Definition: Sema.h:1162
QualType SubstAutoTypeDependent(QualType TypeWithAuto)
void FilterLookupForScope(LookupResult &R, DeclContext *Ctx, Scope *S, bool ConsiderLinkage, bool AllowInlineNamespace)
Filters out lookup results that don't fall within the given scope as determined by isDeclInScope.
Definition: SemaDecl.cpp:1606
QualType CheckSizelessVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
Definition: SemaExpr.cpp:13209
FunctionDecl * FindDeallocationFunctionForDestructor(SourceLocation StartLoc, CXXRecordDecl *RD)
llvm::BumpPtrAllocator BumpAlloc
Definition: Sema.h:817
TemplateDeductionResult DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, ArrayRef< TemplateArgument > TemplateArgs, sema::TemplateDeductionInfo &Info)
SemaOpenMP & OpenMP()
Definition: Sema.h:1014
QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C type parameter type.
Definition: SemaType.cpp:1071
ExprResult ConvertMemberDefaultInitExpression(FieldDecl *FD, Expr *InitExpr, SourceLocation InitLoc)
QualType BuildWritePipeType(QualType T, SourceLocation Loc)
Build a Write-only Pipe type.
Definition: SemaType.cpp:2377
void AddSurrogateCandidate(CXXConversionDecl *Conversion, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, const FunctionProtoType *Proto, Expr *Object, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
AddSurrogateCandidate - Adds a "surrogate" candidate function that converts the given Object to a fun...
ExprResult BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number)
BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the numeric literal expression.
BuildForRangeKind
Definition: Sema.h:8744
@ BFRK_Check
Determining whether a for-range statement could be built.
Definition: Sema.h:8752
@ BFRK_Build
Initial building of a for-range statement.
Definition: Sema.h:8746
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
Definition: Sema.h:8749
bool IsInvalidSMECallConversion(QualType FromType, QualType ToType)
Definition: SemaExpr.cpp:9336
bool resolveAssumedTemplateNameAsType(Scope *S, TemplateName &Name, SourceLocation NameLoc, bool Diagnose=true)
CodeCompleteConsumer * CodeCompleter
Code-completion consumer.
Definition: Sema.h:12774
StmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc, Decl *ExDecl, Stmt *HandlerBlock)
ActOnCXXCatchBlock - Takes an exception declaration and a handler block and creates a proper catch ha...
Definition: SemaStmt.cpp:4432
void ActOnPragmaMSStrictGuardStackCheck(SourceLocation PragmaLocation, PragmaMsStackAction Action, bool Value)
ActOnPragmaMSStrictGuardStackCheck - Called on well formed #pragma strict_gs_check.
Definition: SemaAttr.cpp:774
void ActOnUninitializedDecl(Decl *dcl)
Definition: SemaDecl.cpp:14157
void checkNonTrivialCUnionInInitializer(const Expr *Init, SourceLocation Loc)
Emit diagnostics if the initializer or any of its explicit or implicitly-generated subexpressions req...
Definition: SemaDecl.cpp:13325
SYCLIntelForcePow2DepthAttr * MergeSYCLIntelForcePow2DepthAttr(Decl *D, const SYCLIntelForcePow2DepthAttr &A)
static Scope * getScopeForDeclContext(Scope *S, DeclContext *DC)
Finds the scope corresponding to the given decl context, if it happens to be an enclosing scope.
Definition: SemaDecl.cpp:1589
TypedefDecl * ParseTypedefDecl(Scope *S, Declarator &D, QualType T, TypeSourceInfo *TInfo)
Subroutines of ActOnDeclarator().
Definition: SemaDecl.cpp:17068
SYCLIntelBankWidthAttr * MergeSYCLIntelBankWidthAttr(Decl *D, const SYCLIntelBankWidthAttr &A)
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs)
QualType ActOnPackIndexingType(QualType Pattern, Expr *IndexExpr, SourceLocation Loc, SourceLocation EllipsisLoc)
Definition: SemaType.cpp:9982
sema::LambdaScopeInfo * getEnclosingLambda() const
Get the innermost lambda enclosing the current location, if any.
Definition: Sema.cpp:2443
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
Definition: SemaStmt.cpp:548
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
Definition: SemaExpr.cpp:16639
OffsetOfKind
Definition: Sema.h:3196
@ OOK_Outside
Definition: Sema.h:3198
@ OOK_Macro
Definition: Sema.h:3203
@ OOK_Builtin
Definition: Sema.h:3200
void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit)
AddInitializerToDecl - Adds the initializer Init to the declaration dcl.
Definition: SemaDecl.cpp:13601
QualType BuildTypeofExprType(Expr *E, TypeOfKind Kind)
Definition: SemaType.cpp:9862
bool isUsualDeallocationFunction(const CXXMethodDecl *FD)
PragmaSectionKind
Definition: Sema.h:1431
@ PSK_ConstSeg
Definition: Sema.h:1434
@ PSK_DataSeg
Definition: Sema.h:1432
@ PSK_CodeSeg
Definition: Sema.h:1435
@ PSK_BSSSeg
Definition: Sema.h:1433
TemplateDeductionResult FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned NumExplicitlySpecified, FunctionDecl *&Specialization, sema::TemplateDeductionInfo &Info, SmallVectorImpl< OriginalCallArg > const *OriginalCallArgs=nullptr, bool PartialOverloading=false, llvm::function_ref< bool()> CheckNonDependent=[] { return false;})
Finish template argument deduction for a function template, checking the deduced template arguments f...
void CheckConceptRedefinition(ConceptDecl *NewDecl, LookupResult &Previous, bool &AddToScope)
void DiagnoseDeletedDefaultedFunction(FunctionDecl *FD)
Produce notes explaining why a defaulted function was defined as deleted.
void AddSYCLAddIRAttributesFunctionAttr(Decl *D, const AttributeCommonInfo &CI, MutableArrayRef< Expr * > Args)
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
Definition: Sema.cpp:547
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
Definition: SemaExpr.cpp:20347
void addExternalSource(ExternalSemaSource *E)
Registers an external source.
Definition: Sema.cpp:586
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
Definition: SemaCast.cpp:299
bool DiagnoseAssignmentResult(AssignConvertType ConvTy, SourceLocation Loc, QualType DstType, QualType SrcType, Expr *SrcExpr, AssignmentAction Action, bool *Complained=nullptr)
DiagnoseAssignmentResult - Emit a diagnostic, if required, for the assignment conversion type specifi...
Definition: SemaExpr.cpp:17191
bool CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionExceptionSpec - Checks whether the exception spec is a subset of base spec.
SmallVector< CXXRecordDecl *, 4 > DelayedDllExportClasses
Definition: Sema.h:4797
Decl * ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth)
ActOnField - Each field of a C struct/union is passed into this in order to create a FieldDecl object...
Definition: SemaDecl.cpp:18681
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
Definition: SemaExpr.cpp:18426
CodeAlignAttr * BuildCodeAlignAttr(const AttributeCommonInfo &CI, Expr *E)
ExprResult ActOnStmtExprResult(ExprResult E)
Definition: SemaExpr.cpp:16221
void BuildVariableInstantiation(VarDecl *NewVar, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs, LateInstantiatedAttrVec *LateAttrs, DeclContext *Owner, LocalInstantiationScope *StartingScope, bool InstantiatingVarTemplate=false, VarTemplateSpecializationDecl *PrevVTSD=nullptr)
BuildVariableInstantiation - Used after a new variable has been created.
TypeVisibilityAttr * mergeTypeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI, TypeVisibilityAttr::VisibilityType Vis)
ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Kind, Expr *Input)
Definition: SemaExpr.cpp:5061
void mergeObjCMethodDecls(ObjCMethodDecl *New, ObjCMethodDecl *Old)
Definition: SemaDecl.cpp:4456
bool CheckTemplateParameterList(TemplateParameterList *NewParams, TemplateParameterList *OldParams, TemplateParamListContext TPC, SkipBodyInfo *SkipBody=nullptr)
Checks the validity of a template parameter list, possibly considering the template parameter list fr...
void ActOnCXXForRangeDecl(Decl *D)
Definition: SemaDecl.cpp:14447
bool CheckOverridingFunctionReturnType(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionReturnType - Checks whether the return types are covariant,...
bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl, const FunctionProtoType *Proto, unsigned FirstParam, ArrayRef< Expr * > Args, SmallVectorImpl< Expr * > &AllArgs, VariadicCallType CallType=VariadicDoesNotApply, bool AllowExplicit=false, bool IsListInitialization=false)
GatherArgumentsForCall - Collector argument expressions for various form of call prototypes.
Definition: SemaExpr.cpp:6199
std::tuple< MangleNumberingContext *, Decl * > getCurrentMangleNumberContext(const DeclContext *DC)
Compute the mangling number context for a lambda expression or block literal.
Definition: SemaLambda.cpp:280
bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr, bool Diagnose=true)
Definition: SemaExpr.cpp:17117
QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns, SourceLocation AttrLoc)
Definition: SemaType.cpp:2920
void DiagnoseEqualityWithExtraParens(ParenExpr *ParenE)
Redundant parentheses over an equality comparison can indicate that the user intended an assignment u...
Definition: SemaExpr.cpp:20678
void AddAnnotationAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Annot, MutableArrayRef< Expr * > Args)
AddAnnotationAttr - Adds an annotation Annot with Args arguments to D.
bool isMoreSpecializedThanPrimary(ClassTemplatePartialSpecializationDecl *T, sema::TemplateDeductionInfo &Info)
llvm::MapVector< IdentifierInfo *, llvm::SetVector< WeakInfo, llvm::SmallVector< WeakInfo, 1u >, llvm::SmallDenseSet< WeakInfo, 2u, WeakInfo::DenseMapInfoByAliasOnly > > > WeakUndeclaredIdentifiers
WeakUndeclaredIdentifiers - Identifiers contained in #pragma weak before declared.
Definition: Sema.h:2616
SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID, const FunctionDecl *FD=nullptr)
Definition: Sema.cpp:1993
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
Definition: SemaExpr.cpp:21524
void CompleteLambdaCallOperator(CXXMethodDecl *Method, SourceLocation LambdaLoc, SourceLocation CallOperatorLoc, Expr *TrailingRequiresClause, TypeSourceInfo *MethodTyInfo, ConstexprSpecKind ConstexprKind, StorageClass SC, ArrayRef< ParmVarDecl * > Params, bool HasExplicitResultType)
Definition: SemaLambda.cpp:968
bool hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested, AcceptableKind Kind, bool OnlyNeedComplete=false)
Definition: SemaType.cpp:9397
void CodeCompleteObjCImplementationCategory(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
ExprResult HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, Expr *BaseExpr, SourceLocation OpLoc, DeclarationName MemberName, SourceLocation MemberLoc, SourceLocation SuperLoc, QualType SuperType, bool Super)
HandleExprPropertyRefExpr - Handle foo.bar where foo is a pointer to an objective C interface.
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
Definition: SemaExpr.cpp:15662
PragmaClangSection PragmaClangBSSSection
Definition: Sema.h:1187
Decl * ActOnDeclarator(Scope *S, Declarator &D)
Definition: SemaDecl.cpp:6225
ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope=nullptr)
Definition: SemaExpr.cpp:3988
DeclarationName VAListTagName
VAListTagName - The declaration name corresponding to __va_list_tag.
Definition: Sema.h:921
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
Definition: SemaStmt.cpp:4306
AbstractDiagSelID
Definition: Sema.h:4752
@ AbstractSynthesizedIvarType
Definition: Sema.h:4759
@ AbstractVariableType
Definition: Sema.h:4756
@ AbstractReturnType
Definition: Sema.h:4754
@ AbstractNone
Definition: Sema.h:4753
@ AbstractFieldType
Definition: Sema.h:4757
@ AbstractArrayType
Definition: Sema.h:4760
@ AbstractParamType
Definition: Sema.h:4755
@ AbstractIvarType
Definition: Sema.h:4758
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
Definition: SemaExpr.cpp:3280
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
Definition: SemaStmt.cpp:909
MSPropertyDecl * HandleMSProperty(Scope *S, RecordDecl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, InClassInitStyle InitStyle, AccessSpecifier AS, const ParsedAttr &MSPropertyAttr)
HandleMSProperty - Analyze a __delcspec(property) field of a C++ class.
void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, const WeakInfo &W)
bool InstantiateEnum(SourceLocation PointOfInstantiation, EnumDecl *Instantiation, EnumDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiate the definition of an enum from a given pattern.
ExprResult BuildInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
Definition: SemaExpr.cpp:7503
void CodeCompletePreprocessorDirective(bool InConditional)
SYCLIntelMinWorkGroupsPerComputeUnitAttr * MergeSYCLIntelMinWorkGroupsPerComputeUnitAttr(Decl *D, const SYCLIntelMinWorkGroupsPerComputeUnitAttr &A)
PragmaOptionsAlignKind
Definition: Sema.h:1526
@ POAK_Power
Definition: Sema.h:1530
@ POAK_Reset
Definition: Sema.h:1532
@ POAK_Packed
Definition: Sema.h:1529
@ POAK_Mac68k
Definition: Sema.h:1531
@ POAK_Natural
Definition: Sema.h:1528
@ POAK_Native
Definition: Sema.h:1527
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
Definition: SemaExpr.cpp:16477
void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)
void ProcessAPINotes(Decl *D)
Map any API notes provided for this declaration to attributes on the declaration.
bool CheckAttrNoArgs(const ParsedAttr &CurrAttr)
WebAssemblyImportNameAttr * mergeImportNameAttr(Decl *D, const WebAssemblyImportNameAttr &AL)
sema::FunctionScopeInfo * getCurFunction() const
Definition: Sema.h:893
ParsedType getConstructorName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, bool EnteringContext)
Definition: SemaExprCXX.cpp:94
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
Definition: SemaExpr.cpp:5134
std::string getTemplateArgumentBindingsText(const TemplateParameterList *Params, const TemplateArgumentList &Args)
Produces a formatted string that describes the binding of template parameters to template arguments.
void HandleDelayedAccessCheck(sema::DelayedDiagnostic &DD, Decl *Ctx)
bool CheckRedeclarationInModule(NamedDecl *New, NamedDecl *Old)
Definition: SemaDecl.cpp:1729
LazyDeclPtr StdAlignValT
The C++ "std::align_val_t" enum class, which is defined by the C++ standard library.
Definition: Sema.h:6649
ExprResult ActOnNameClassifiedAsDependentNonType(const CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, bool IsAddressOfOperand)
Act on the result of classifying a name as an undeclared member of a dependent base class.
Definition: SemaDecl.cpp:1258
Decl * ActOnObjCExceptionDecl(Scope *S, Declarator &D)
bool SubstTemplateArgument(const TemplateArgumentLoc &Input, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateArgumentLoc &Output)
ExprResult CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
CreateBuiltinBinOp - Creates a new built-in binary operation with operator Opc at location TokLoc.
Definition: SemaExpr.cpp:15131
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
ObjCMethodDecl * LookupFactoryMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupFactoryMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
Definition: Sema.h:12652
Decl * ActOnFinishExportDecl(Scope *S, Decl *ExportDecl, SourceLocation RBraceLoc)
Complete the definition of an export declaration.
Definition: SemaModule.cpp:980
ExprResult BuildClassMessageImplicit(QualType ReceiverType, bool isSuperReceiver, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI)
Note that we have finished the explicit captures for the given lambda.
Definition: SemaLambda.cpp:500
ObjCSubscriptKind
Definition: Sema.h:8628
@ OS_Array
Definition: Sema.h:8628
@ OS_Dictionary
Definition: Sema.h:8628
@ OS_Error
Definition: Sema.h:8628
QualType BuiltinChangeSignedness(QualType BaseType, UTTKind UKind, SourceLocation Loc)
Definition: SemaType.cpp:10201
AssignConvertType CheckAssignmentConstraints(SourceLocation Loc, QualType LHSType, QualType RHSType)
CheckAssignmentConstraints - Perform type checking for assignment, argument passing,...
Definition: SemaExpr.cpp:9611
void DiagnoseUnsatisfiedConstraint(const ConstraintSatisfaction &Satisfaction, bool First=true)
Emit diagnostics explaining why a constraint expression was deemed unsatisfied.
void ActOnPragmaFPContract(SourceLocation Loc, LangOptions::FPModeKind FPC)
ActOnPragmaFPContract - Called on well formed #pragma {STDC,OPENCL} FP_CONTRACT and #pragma clang fp ...
Definition: SemaAttr.cpp:1280
void adjustMemberFunctionCC(QualType &T, bool HasThisPointer, bool IsCtorOrDtor, SourceLocation Loc)
Adjust the calling convention of a method to be the ABI default if it wasn't specified explicitly.
Definition: SemaType.cpp:8451
ExprResult BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, QualType ParamType, SourceLocation Loc)
Given a non-type template argument that refers to a declaration and the type of its corresponding non...
void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc)
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc)
Called on well formed #pragma clang optimize.
Definition: SemaAttr.cpp:1151
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
Definition: SemaExpr.cpp:6684
ExprResult ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, bool IsType, void *TyOrEx, SourceRange ArgRange)
ActOnUnaryExprOrTypeTraitExpr - Handle sizeof(type) and sizeof expr and the same for alignof and __al...
Definition: SemaExpr.cpp:4984
QualType PreferredConditionType(ConditionKind K) const
Definition: Sema.h:6179
void AddSYCLIntelNumSimdWorkItemsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
ForRangeStatus BuildForRangeBeginEndCall(SourceLocation Loc, SourceLocation RangeLoc, const DeclarationNameInfo &NameInfo, LookupResult &MemberLookup, OverloadCandidateSet *CandidateSet, Expr *Range, ExprResult *CallExpr)
Build a call to 'begin' or 'end' for a C++11 for-range statement.
void clearDelayedTypo(TypoExpr *TE)
Clears the state of the given TypoExpr.
ObjCMessageKind
Describes the kind of message expression indicated by a message send that starts with an identifier.
Definition: Sema.h:12497
@ ObjCSuperMessage
The message is sent to 'super'.
Definition: Sema.h:12499
@ ObjCClassMessage
The message is a class message, and the identifier is a type name.
Definition: Sema.h:12504
@ ObjCInstanceMessage
The message is an instance message.
Definition: Sema.h:12501
LiteralOperatorLookupResult
The possible outcomes of name lookup for a literal operator.
Definition: Sema.h:7594
@ LOLR_ErrorNoDiagnostic
The lookup found no match but no diagnostic was issued.
Definition: Sema.h:7598
@ LOLR_Raw
The lookup found a single 'raw' literal operator, which expects a string literal containing the spell...
Definition: Sema.h:7604
@ LOLR_Error
The lookup resulted in an error.
Definition: Sema.h:7596
@ LOLR_Cooked
The lookup found a single 'cooked' literal operator, which expects a normal literal to be built and p...
Definition: Sema.h:7601
@ LOLR_StringTemplatePack
The lookup found an overload set of literal operator templates, which expect the character type and c...
Definition: Sema.h:7612
@ LOLR_Template
The lookup found an overload set of literal operator templates, which expect the characters of the sp...
Definition: Sema.h:7608
void ActOnPragmaWeakAlias(IdentifierInfo *WeakName, IdentifierInfo *AliasName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc, SourceLocation AliasNameLoc)
ActOnPragmaWeakAlias - Called on well formed #pragma weak ident = ident.
Definition: SemaDecl.cpp:20742
sema::FunctionScopeInfo * getEnclosingFunction() const
Definition: Sema.cpp:2431
void AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
AddAlignValueAttr - Adds an align_value attribute to a particular declaration.
void AddSYCLIntelMinWorkGroupsPerComputeUnitAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, Scope *CurScope)
ActOnBlockArguments - This callback allows processing of block arguments.
Definition: SemaExpr.cpp:16506
BTFDeclTagAttr * mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL)
void CodeCompletePreprocessorExpression()
QualType CheckRemainderOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign=false)
Definition: SemaExpr.cpp:11059
void CodeCompleteObjCForCollection(Scope *S, DeclGroupPtrTy IterationVar)
CheckConstexprKind
Definition: Sema.h:4903
ExprResult InitializeExplicitObjectArgument(Sema &S, Expr *Obj, FunctionDecl *Fun)
std::pair< ValueDecl *, SourceLocation > PendingImplicitInstantiation
An entity for which implicit template instantiation is required.
Definition: Sema.h:10702
void CheckVariableDeclarationType(VarDecl *NewVD)
Definition: SemaDecl.cpp:8808
void AddSYCLIntelLoopFuseAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
sema::CompoundScopeInfo & getCurCompoundScope() const
Definition: SemaStmt.cpp:411
DeclContext * FindInstantiatedContext(SourceLocation Loc, DeclContext *DC, const MultiLevelTemplateArgumentList &TemplateArgs)
Finds the instantiation of the given declaration context within the current instantiation.
sema::CapturedRegionScopeInfo * getCurCapturedRegion()
Retrieve the current captured region, if any.
Definition: Sema.cpp:2800
OpaquePtr< TemplateName > TemplateTy
Definition: Sema.h:851
unsigned getTemplateDepth(Scope *S) const
Determine the number of levels of enclosing template parameters.
void warnStackExhausted(SourceLocation Loc)
Warn that the stack is nearly exhausted.
Definition: Sema.cpp:539
Decl * ActOnIvar(Scope *S, SourceLocation DeclStart, Declarator &D, Expr *BitWidth, tok::ObjCKeywordKind visibility)
ActOnIvar - Each ivar field of an objective-c class is passed into this in order to create an IvarDec...
Definition: SemaDecl.cpp:19064
bool CanPerformCopyInitialization(const InitializedEntity &Entity, ExprResult Init)
Definition: SemaInit.cpp:10658
SkippedDefinitionContext ActOnTagStartSkippedDefinition(Scope *S, Decl *TD)
Invoked when we enter a tag definition that we're skipping.
Definition: SemaDecl.cpp:1343
void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E)
Warn when implicitly casting 0 to nullptr.
Definition: Sema.cpp:624
bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E)
CheckCXXThrowOperand - Validate the operand of a throw.
bool DeduceVariableDeclarationType(VarDecl *VDecl, bool DirectInit, Expr *Init)
Definition: SemaDecl.cpp:13291
TemplateDeductionResult DeduceAutoType(TypeLoc AutoTypeLoc, Expr *Initializer, QualType &Result, sema::TemplateDeductionInfo &Info, bool DependentDeduction=false, bool IgnoreConstraints=false, TemplateSpecCandidateSet *FailedTSC=nullptr)
Deduce the type for an auto type-specifier (C++11 [dcl.spec.auto]p6)
DeclContext * getCurLexicalContext() const
Definition: Sema.h:703
void ActOnPragmaDump(Scope *S, SourceLocation Loc, IdentifierInfo *II)
Called on #pragma clang __debug dump II.
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
void ActOnPragmaFEnvAccess(SourceLocation Loc, bool IsEnabled)
ActOnPragmaFenvAccess - Called on well formed #pragma STDC FENV_ACCESS.
Definition: SemaAttr.cpp:1351
bool SubstBaseSpecifiers(CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
Perform substitution on the base class specifiers of the given class template specialization.
SYCLIntelInitiationIntervalAttr * MergeSYCLIntelInitiationIntervalAttr(Decl *D, const SYCLIntelInitiationIntervalAttr &A)
void LoadExternalVTableUses()
Load any externally-stored vtable uses.
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
Definition: SemaType.cpp:3237
ObjCMethodDecl * DictionaryWithObjectsMethod
The declaration of the dictionaryWithObjects:forKeys:count: method.
Definition: Sema.h:12419
llvm::SmallPtrSet< const NamedDecl *, 4 > TypoCorrectedFunctionDefinitions
The function definitions which were renamed as part of typo-correction to match their respective decl...
Definition: Sema.h:2597
void ActOnFinishOfCompoundStmt()
Definition: SemaStmt.cpp:407
concepts::Requirement * ActOnNestedRequirement(Expr *Constraint)
QualType adjustCCAndNoReturn(QualType ArgFunctionType, QualType FunctionType, bool AdjustExceptionSpec=false)
Adjust the type ArgFunctionType to match the calling convention, noreturn, and optionally the excepti...
bool CheckForwardProtocolDeclarationForCircularDependency(IdentifierInfo *PName, SourceLocation &PLoc, SourceLocation PrevLoc, const ObjCList< ObjCProtocolDecl > &PList)
ExprResult ActOnObjCAvailabilityCheckExpr(llvm::ArrayRef< AvailabilitySpec > AvailSpecs, SourceLocation AtLoc, SourceLocation RParen)
Definition: SemaExpr.cpp:21490
SYCLReqdWorkGroupSizeAttr * MergeSYCLReqdWorkGroupSizeAttr(Decl *D, const SYCLReqdWorkGroupSizeAttr &A)
bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType)
Helper function to determine whether this is the (deprecated) C++ conversion from a string literal to...
Decl * ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc, SourceLocation NamespcLoc, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *NamespcName, const ParsedAttributesView &AttrList)
bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType)
void AddSectionMSAllocText(FunctionDecl *FD)
Only called on function definitions; if there is a #pragma alloc_text that decides which code section...
Definition: SemaAttr.cpp:1184
void computeNRVO(Stmt *Body, sema::FunctionScopeInfo *Scope)
Given the set of return statements within a function body, compute the variables that are subject to ...
Definition: SemaDecl.cpp:16062
ObjCSpecialMethodKind
Definition: Sema.h:11997
@ OSMK_Copy
Definition: Sema.h:12001
@ OSMK_NonRetainingInit
Definition: Sema.h:12003
@ OSMK_RetainingInit
Definition: Sema.h:12002
@ OSMK_None
Definition: Sema.h:11998
@ OSMK_Alloc
Definition: Sema.h:11999
@ OSMK_New
Definition: Sema.h:12000
bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args)
Definition: Sema.h:11846
DiagnosticsEngine & getDiagnostics() const
Definition: Sema.h:525
void checkNonTrivialCUnion(QualType QT, SourceLocation Loc, NonTrivialCUnionContext UseContext, unsigned NonTrivialKind)
Emit diagnostics if a non-trivial C union type or a struct that contains a non-trivial C union is use...
Definition: SemaDecl.cpp:13577
QualType CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, QualType *CompLHSTy=nullptr)
Definition: SemaExpr.cpp:11492
static ConditionResult ConditionError()
Definition: Sema.h:6054
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
Definition: SemaStmt.cpp:415
void NoteTemplateParameterLocation(const NamedDecl &Decl)
ExprResult ActOnConvertVectorExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_convertvector(...)
Definition: SemaExpr.cpp:6971
bool CheckNonDependentConversions(FunctionTemplateDecl *FunctionTemplate, ArrayRef< QualType > ParamTypes, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, ConversionSequenceList &Conversions, bool SuppressUserConversions, CXXRecordDecl *ActingContext=nullptr, QualType ObjectType=QualType(), Expr::Classification ObjectClassification={}, OverloadCandidateParamOrder PO={})
Check that implicit conversion sequences can be formed for each argument whose corresponding paramete...
void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, QualType FromType, QualType ToType)
HandleFunctionTypeMismatch - Gives diagnostic information for differeing function types.
void ActOnStartTrailingRequiresClause(Scope *S, Declarator &D)
const NormalizedConstraint * getNormalizedAssociatedConstraints(NamedDecl *ConstrainedDecl, ArrayRef< const Expr * > AssociatedConstraints)
AttributeCompletion
Definition: Sema.h:12846
void FindHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
Check if a method overloads virtual methods in a base class without overriding any.
IdentifierResolver IdResolver
Definition: Sema.h:2545
DeclResult ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc, unsigned TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, MultiTemplateParamsArg TempParamLists)
Handle a friend tag declaration where the scope specifier was templated.
bool IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS, NestedNameSpecInfo &IdInfo, bool EnteringContext)
IsInvalidUnlessNestedName - This method is used for error recovery purposes to determine whether the ...
const TypoExprState & getTypoExprState(TypoExpr *TE) const
llvm::DenseSet< QualType > InstantiatedNonDependentTypes
Non-dependent types used in templates that have already been instantiated by some template instantiat...
Definition: Sema.h:10439
ExprResult checkUnknownAnyArg(SourceLocation callLoc, Expr *result, QualType &paramType)
Type-check an expression that's being passed to an __unknown_anytype parameter.
Definition: SemaExpr.cpp:21225
void addSYCLIntelPipeIOAttr(Decl *D, const AttributeCommonInfo &CI, Expr *ID)
addSYCLIntelPipeIOAttr - Adds a pipe I/O attribute to a particular declaration.
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
Definition: SemaStmt.cpp:4422
bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val, bool AllowMask) const
IsValueInFlagEnum - Determine if a value is allowed as part of a flag enum.
Definition: SemaDecl.cpp:20403
SYCLIntelLoopCountAttr * BuildSYCLIntelLoopCountAttr(const AttributeCommonInfo &CI, Expr *E)
bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, FunctionDecl *FDecl, const FunctionProtoType *Proto, ArrayRef< Expr * > Args, SourceLocation RParenLoc, bool ExecConfig=false)
ConvertArgumentsForCall - Converts the arguments specified in Args/NumArgs to the parameter types of ...
Definition: SemaExpr.cpp:6061
ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc, SourceLocation TypeLoc, ParsedType ParsedArgTy, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
Definition: SemaExpr.cpp:16419
bool hasAnyUnrecoverableErrorsInThisFunction() const
Determine whether any errors occurred within this function/method/ block.
Definition: Sema.cpp:2392
StmtResult ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl, SourceLocation ColonLoc, Stmt *SubStmt)
Definition: SemaStmt.cpp:573
void AddAllocAlignAttr(Decl *D, const AttributeCommonInfo &CI, Expr *ParamExpr)
AddAllocAlignAttr - Adds an alloc_align attribute to a particular declaration.
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
Definition: SemaStmt.cpp:4560
FullExprArg MakeFullExpr(Expr *Arg)
Definition: Sema.h:6010
void PerformDependentDiagnostics(const DeclContext *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
DeclContextLookupResult LookupConstructors(CXXRecordDecl *Class)
Look up the constructors for the given class.
void DiagnoseUnknownTypeName(IdentifierInfo *&II, SourceLocation IILoc, Scope *S, CXXScopeSpec *SS, ParsedType &SuggestedType, bool IsTemplateName=false)
Definition: SemaDecl.cpp:701
void DiagnoseSizeOfParametersAndReturnValue(ArrayRef< ParmVarDecl * > Parameters, QualType ReturnTy, NamedDecl *D)
Diagnose whether the size of parameters or return value of a function or obj-c method definition is p...
Definition: SemaDecl.cpp:15410
AMDGPUFlatWorkGroupSizeAttr * CreateAMDGPUFlatWorkGroupSizeAttr(const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
Create an AMDGPUWavesPerEUAttr attribute.
void CheckDeductionGuideTemplate(FunctionTemplateDecl *TD)
bool IsFunctionConversion(QualType FromType, QualType ToType, QualType &ResultTy)
Determine whether the conversion from FromType to ToType is a valid conversion that strips "noexcept"...
void ActOnStartDelayedMemberDeclarations(Scope *S, Decl *Record)
llvm::SmallVector< std::pair< SourceLocation, const BlockDecl * >, 1 > ImplicitlyRetainedSelfLocs
List of SourceLocations where 'self' is implicitly retained inside a block.
Definition: Sema.h:6615
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
Definition: Sema.h:850
ObjCInterfaceDecl * NSValueDecl
The declaration of the Objective-C NSValue class.
Definition: Sema.h:12386
static int getPrintable(int I)
Definition: Sema.h:11628
TypeResult ActOnTagTemplateIdType(TagUseKind TUK, TypeSpecifierType TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy TemplateD, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgsIn, SourceLocation RAngleLoc)
Parsed an elaborated-type-specifier that refers to a template-id, such as class T::template apply.
void ActOnPragmaMSSection(SourceLocation PragmaLocation, int SectionFlags, StringLiteral *SegmentName)
Called on well formed #pragma section().
Definition: SemaAttr.cpp:785
QualType BuildCountAttributedArrayType(QualType WrappedTy, Expr *CountExpr)
Definition: SemaType.cpp:9885
bool hasReachableDeclaration(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine whether any declaration of an entity is reachable.
Definition: Sema.h:7730
void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer, ArrayRef< IdentifierLocPair > ProtocolId, SmallVectorImpl< Decl * > &Protocols)
FindProtocolDeclaration - This routine looks up protocols and issues an error if they are not declare...
void MarkDeducedTemplateParameters(const FunctionTemplateDecl *FunctionTemplate, llvm::SmallBitVector &Deduced)
Definition: Sema.h:9915
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
Definition: SemaStmt.cpp:553
bool SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMemberKind CSM, TrivialABIHandling TAH=TAH_IgnoreTrivialABI, bool Diagnose=false)
Determine whether a defaulted or deleted special member function is trivial, as specified in C++11 [c...
ObjCContainerKind getObjCContainerKind() const
ExprResult ActOnCXXThis(SourceLocation Loc)
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
bool DiagnoseUnexpandedParameterPacks(SourceLocation Loc, UnexpandedParameterPackContext UPPC, ArrayRef< UnexpandedParameterPack > Unexpanded)
Diagnose unexpanded parameter packs.
TemplateNameKindForDiagnostics
Describes the detailed kind of a template name. Used in diagnostics.
Definition: Sema.h:2888
bool CheckAltivecInitFromScalar(SourceRange R, QualType VecTy, QualType SrcTy)
Definition: SemaCast.cpp:2722
SYCLIntelNoGlobalWorkOffsetAttr * MergeSYCLIntelNoGlobalWorkOffsetAttr(Decl *D, const SYCLIntelNoGlobalWorkOffsetAttr &A)
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
Definition: SemaExpr.cpp:18251
CXXConstructorDecl * findInheritingConstructor(SourceLocation Loc, CXXConstructorDecl *BaseCtor, ConstructorUsingShadowDecl *DerivedShadow)
Given a derived-class using shadow declaration for a constructor and the correspnding base class cons...
PragmaClangSectionKind
pragma clang section kind
Definition: Sema.h:1170
@ PCSK_Invalid
Definition: Sema.h:1171
@ PCSK_BSS
Definition: Sema.h:1172
@ PCSK_Data
Definition: Sema.h:1173
@ PCSK_Text
Definition: Sema.h:1175
@ PCSK_Relro
Definition: Sema.h:1176
@ PCSK_Rodata
Definition: Sema.h:1174
ExprResult ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
Definition: SemaExpr.cpp:7435
void warnOnReservedIdentifier(const NamedDecl *D)
Definition: SemaDecl.cpp:6212
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
Definition: SemaStmt.cpp:516
DLLImportAttr * mergeDLLImportAttr(Decl *D, const AttributeCommonInfo &CI)
bool isCheckingDefaultArgumentOrInitializer() const
Definition: Sema.h:6470
bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped, QualType EnumUnderlyingTy, bool IsFixed, const EnumDecl *Prev)
Check whether this is a valid redeclaration of a previous enumeration.
Definition: SemaDecl.cpp:17144
void ActOnObjCTemporaryExitContainerContext(ObjCContainerDecl *ObjCCtx)
Invoked when we must temporarily exit the objective-c container scope for parsing/looking-up C constr...
Definition: SemaDecl.cpp:18561
bool CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD, CXXSpecialMemberKind CSM, SourceLocation DefaultLoc)
bool isCurrentClassNameTypo(IdentifierInfo *&II, const CXXScopeSpec *SS)
Determine whether the identifier II is a typo for the name of the class type currently being defined.
SemaCUDA & CUDA()
Definition: Sema.h:999
void inferNullableClassAttribute(CXXRecordDecl *CRD)
Add _Nullable attributes for std:: types.
Definition: SemaAttr.cpp:218
bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType, const CXXScopeSpec &SS, const LookupResult &R)
NamedDecl * ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope, ArrayRef< BindingDecl * > Bindings=std::nullopt)
Definition: SemaDecl.cpp:7625
ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C instance message expression.
Decl * ActOnUsingDeclaration(Scope *CurScope, AccessSpecifier AS, SourceLocation UsingLoc, SourceLocation TypenameLoc, CXXScopeSpec &SS, UnqualifiedId &Name, SourceLocation EllipsisLoc, const ParsedAttributesView &AttrList)
void AddSYCLIntelInitiationIntervalAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param)
ActOnDelayedCXXMethodParameter - We've already started a delayed C++ method declaration.
void diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl)
Diagnose any null-resettable synthesized setters.
bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall, const FunctionProtoType *Proto)
CheckFunctionCall - Check a direct function call for various correctness and safety properties not st...
void DefaultSynthesizeProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl, SourceLocation AtEnd)
DefaultSynthesizeProperties - This routine default synthesizes all properties which must be synthesiz...
void AddMemberOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, OverloadCandidateParamOrder PO={})
Add overload candidates for overloaded operators that are member functions.
ExprResult ActOnDecltypeExpression(Expr *E)
Process the expression contained within a decltype.
QualType BuildMemberPointerType(QualType T, QualType Class, SourceLocation Loc, DeclarationName Entity)
Build a member pointer type T Class::*.
Definition: SemaType.cpp:3157
void DiagnoseMultipleMethodInGlobalPool(SmallVectorImpl< ObjCMethodDecl * > &Methods, Selector Sel, SourceRange R, bool receiverIdOrClass)
AllocationFunctionScope
The scope in which to find allocation functions.
Definition: Sema.h:6824
@ AFS_Both
Look for allocation functions in both the global scope and in the scope of the allocated class.
Definition: Sema.h:6832
@ AFS_Class
Only look for allocation functions in the scope of the allocated class.
Definition: Sema.h:6829
@ AFS_Global
Only look for allocation functions in the global scope.
Definition: Sema.h:6826
bool isAbstractType(SourceLocation Loc, QualType T)
bool CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param, Expr *Init=nullptr, bool SkipImmediateInvocations=true)
Instantiate or parse a C++ default argument expression as necessary.
Definition: SemaExpr.cpp:5645
ValueDecl * tryLookupUnambiguousFieldDecl(RecordDecl *ClassDecl, const IdentifierInfo *MemberOrBase)
void CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc, ArrayRef< const IdentifierInfo * > SelIdents, bool AtArgumentExpression)
ASTMutationListener * getASTMutationListener() const
Definition: Sema.cpp:577
QualType BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a block pointer type.
Definition: SemaType.cpp:3220
PragmaMsStackAction
Definition: Sema.h:1193
@ PSK_Push_Set
Definition: Sema.h:1199
@ PSK_Reset
Definition: Sema.h:1194
@ PSK_Pop_Set
Definition: Sema.h:1200
@ PSK_Show
Definition: Sema.h:1198
@ PSK_Pop
Definition: Sema.h:1197
@ PSK_Set
Definition: Sema.h:1195
@ PSK_Push
Definition: Sema.h:1196
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
Definition: SemaStmt.cpp:3306
void AddSYCLIntelMaxWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI, Expr *XDim, Expr *YDim, Expr *ZDim)
ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult { return E;})
Process any TypoExprs in the given Expr and its children, generating diagnostics as appropriate and r...
static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, const Decl *D, SourceLocation Loc=SourceLocation())
Determine whether the callee of a particular function call can throw.
void CheckVirtualDtorCall(CXXDestructorDecl *dtor, SourceLocation Loc, bool IsDelete, bool CallCanBeVirtual, bool WarnOnNonAbstractTypes, SourceLocation DtorLoc)
void DiagnoseImmediateEscalatingReason(FunctionDecl *FD)
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
Definition: Sema.h:6902
void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType)
FinalizeVarWithDestructor - Prepare for calling destructor on the constructed variable.
CXXDestructorDecl * DeclareImplicitDestructor(CXXRecordDecl *ClassDecl)
Declare the implicit destructor for the given class.
NamedDecl * DeclClonePragmaWeak(NamedDecl *ND, const IdentifierInfo *II, SourceLocation Loc)
TypeSourceInfo * SubstFunctionDeclType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, CXXRecordDecl *ThisContext, Qualifiers ThisTypeQuals, bool EvaluateConstraints=true)
A form of SubstType intended specifically for instantiating the type of a FunctionDecl.
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
Definition: SemaExpr.cpp:5302
ExprResult ActOnNameClassifiedAsOverloadSet(Scope *S, Expr *OverloadSet)
Act on the result of classifying a name as an overload set.
Definition: SemaDecl.cpp:1285
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
void createImplicitModuleImportForErrorRecovery(SourceLocation Loc, Module *Mod)
Create an implicit import of the given module at the given source location, for error recovery,...
Definition: SemaModule.cpp:823
ExprResult ParseObjCSelectorExpression(Selector Sel, SourceLocation AtLoc, SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool WarnMultipleSelectors)
ParseObjCSelectorExpression - Build selector expression for @selector.
Encodes a location in the source.
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3....
Definition: Overload.h:267
Stmt - This represents one statement.
Definition: Stmt.h:84
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:326
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1773
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3586
Exposes information about the current target.
Definition: TargetInfo.h:213
A convenient class for passing around template argument information.
Definition: TemplateBase.h:632
A template argument list.
Definition: DeclTemplate.h:244
Location wrapper for a TemplateArgument.
Definition: TemplateBase.h:524
Represents a template argument.
Definition: TemplateBase.h:61
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:394
Represents a C++ template name within the type system.
Definition: TemplateName.h:202
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:73
TemplateSpecCandidateSet - A set of generalized overload candidates, used in template specializations...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Declaration of a template type parameter.
Token - This structure provides full information about a lexed token.
Definition: Token.h:36
A declaration that models statements at global scope.
Definition: Decl.h:4459
Declaration of an alias template.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Definition: ASTConcept.h:231
Represents a declaration of a type.
Definition: Decl.h:3392
Base wrapper for a particular "section" of type source info.
Definition: TypeLoc.h:59
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Definition: TypeLoc.h:153
A container of type source information.
Definition: Type.h:7130
The base class of the type hierarchy.
Definition: Type.h:1607
bool isSizelessType() const
As an extension, we classify types as one of "sized" or "sizeless"; every type is one or the other.
Definition: Type.cpp:2454
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition: Decl.h:3536
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3434
Simple class containing the result of Sema::CorrectTypo.
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition: Expr.h:6626
Represents a C++ unqualified-id that has been parsed.
Definition: DeclSpec.h:1024
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:3173
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition: ExprCXX.h:3912
A set of unresolved declarations.
Definition: UnresolvedSet.h:61
Represents a C++ using-declaration.
Definition: DeclCXX.h:3509
Represents C++ using-directive.
Definition: DeclCXX.h:3012
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition: DeclCXX.h:3317
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:707
Represents a variable declaration or definition.
Definition: Decl.h:919
Declaration of a variable template.
Represents a variable template specialization, which refers to a variable template with a given set o...
Represents a GCC generic vector type.
Definition: Type.h:3769
Represents a C++11 virt-specifier-seq.
Definition: DeclSpec.h:2778
Consumes visible declarations found when searching for all visible names within a given scope or cont...
Definition: Lookup.h:834
Captures information about a #pragma weak directive.
Definition: Weak.h:25
The API notes manager helps find API notes associated with declarations.
A requires-expression requirement which queries the validity and properties of an expression ('simple...
Definition: ExprConcepts.h:280
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
Definition: ExprConcepts.h:429
A static requirement that can be used in a requires-expression to check properties of types and expre...
Definition: ExprConcepts.h:168
A requires-expression requirement which queries the existence of a type name or type template special...
Definition: ExprConcepts.h:225
Retains information about a block that is currently being parsed.
Definition: ScopeInfo.h:784
Retains information about a captured region.
Definition: ScopeInfo.h:810
Contains information about the compound statement currently being parsed.
Definition: ScopeInfo.h:67
A collection of diagnostics which were delayed.
A diagnostic message which has been conditionally emitted pending the complete parsing of the current...
Retains information about a function, method, or block that is currently being parsed.
Definition: ScopeInfo.h:104
Provides information about an attempted template argument deduction, whose success or failure was des...
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
llvm::DenseMap< int, SourceRange > ParsedSubjectMatchRuleSet
uint32_t Literal
Literals are represented as positive integers.
llvm::APInt APInt
Definition: Integral.h:29
bool This(InterpState &S, CodePtr OpPC)
Definition: Interp.h:1893
bool Init(InterpState &S, CodePtr OpPC)
Definition: Interp.h:1461
bool Comp(InterpState &S, CodePtr OpPC)
1) Pops the value from the stack.
Definition: Interp.h:708
void threadSafetyCleanup(BeforeSet *Cache)
ObjCKeywordKind
Provides a namespace for Objective-C keywords which start with an '@'.
Definition: TokenKinds.h:41
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Definition: TokenKinds.h:25
llvm::cl::opt< std::string > Filter
RangeSelector range(RangeSelector Begin, RangeSelector End)
DEPRECATED. Use enclose.
Definition: RangeSelector.h:41
RangeSelector name(std::string ID)
Given a node with a "name", (like NamedDecl, DeclRefExpr, CxxCtorInitializer, and TypeLoc) selects th...
The JSON file list parser is used to communicate input to InstallAPI.
TypeSpecifierType
Specifies the kind of type.
Definition: Specifiers.h:55
ImplicitTypenameContext
Definition: DeclSpec.h:1881
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:21
PragmaFPKind
Definition: PragmaKinds.h:38
ArrayTypeTrait
Names for the array type traits.
Definition: TypeTraits.h:42
@ CPlusPlus
Definition: LangStandard.h:55
llvm::MutableArrayRef< ImplicitConversionSequence > ConversionSequenceList
A list of implicit conversion sequences for the arguments of an OverloadCandidate.
Definition: Overload.h:845
CUDAFunctionTarget
Definition: Cuda.h:131
CanThrowResult
Possible results from evaluation of a noexcept expression.
PragmaMSCommentKind
Definition: PragmaKinds.h:14
ConstexprSpecKind
Define the kind of constexpr specifier.
Definition: Specifiers.h:35
IfStatementKind
In an if statement, this denotes whether the statement is a constexpr or consteval if statement.
Definition: Specifiers.h:39
ArrayRef< std::pair< IdentifierInfo *, SourceLocation > > ModuleIdPath
A sequence of identifier/location pairs used to describe a particular module or submodule,...
Definition: ModuleLoader.h:32
ObjCPropertyQueryKind
Definition: DeclObjC.h:717
NullabilityKind
Describes the nullability of a particular type.
Definition: Specifiers.h:333
InClassInitStyle
In-class initialization styles for non-static data members.
Definition: Specifiers.h:268
CXXConstructionKind
Definition: ExprCXX.h:1532
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Definition: Specifiers.h:146
BinaryOperatorKind
OverloadCandidateParamOrder
The parameter ordering that will be used for the candidate.
Definition: Overload.h:84
std::unique_ptr< sema::RISCVIntrinsicManager > CreateRISCVIntrinsicManager(Sema &S)
TypeOfKind
The kind of 'typeof' expression we're after.
Definition: Type.h:719
bool operator==(const CallGraphNode::CallRecord &LHS, const CallGraphNode::CallRecord &RHS)
Definition: CallGraph.h:223
CapturedRegionKind
The different kinds of captured statement.
Definition: CapturedStmt.h:16
StorageClass
Storage classes.
Definition: Specifiers.h:245
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
Definition: TypeTraits.h:51
OverloadCandidateRewriteKind
The kinds of rewrite we perform on overload candidates.
Definition: Overload.h:89
LambdaCaptureInitKind
Definition: DeclSpec.h:2822
@ CopyInit
[a = b], [a = {b}]
@ Module
Module linkage, which indicates that the entity can be referred to from other translation units withi...
ArraySizeModifier
Capture whether this is a normal array (e.g.
Definition: Type.h:3315
ParameterABI
Kinds of parameter ABI.
Definition: Specifiers.h:363
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
ObjCBridgeCastKind
The kind of bridging performed by the Objective-C bridge cast.
MSVtorDispMode
In the Microsoft ABI, this controls the placement of virtual displacement members used to implement v...
Definition: LangOptions.h:35
UnaryOperatorKind
ActionResult< Expr * > ExprResult
Definition: Ownership.h:248
TagTypeKind
The kind of a tag type.
Definition: Type.h:6099
DeductionFailureInfo MakeDeductionFailureInfo(ASTContext &Context, TemplateDeductionResult TDK, sema::TemplateDeductionInfo &Info)
Convert from Sema's representation of template deduction information to the form used in overload-can...
llvm::PointerUnion< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
Definition: DeclTemplate.h:65
LangAS
Defines the address space values used by the address space qualifier of QualType.
Definition: AddressSpaces.h:25
CastKind
CastKind - The kind of operation required for a conversion.
TranslationUnitKind
Describes the kind of translation unit being processed.
Definition: LangOptions.h:1070
@ TU_Complete
The translation unit is a complete translation unit.
Definition: LangOptions.h:1072
@ TU_Prefix
The translation unit is a prefix to a translation unit, and is not complete.
Definition: LangOptions.h:1076
ComparisonCategoryType
An enumeration representing the different comparison categories types.
PragmaMSStructKind
Definition: PragmaKinds.h:23
ActionResult< Stmt * > StmtResult
Definition: Ownership.h:249
CXXSpecialMemberKind
Kinds of C++ special members.
Definition: Sema.h:432
TemplateNameKind
Specifies the kind of template name that an identifier refers to.
Definition: TemplateKinds.h:20
@ TNK_Var_template
The name refers to a variable template whose specialization produces a variable.
Definition: TemplateKinds.h:33
@ TNK_Type_template
The name refers to a template whose specialization produces a type.
Definition: TemplateKinds.h:30
@ TNK_Function_template
The name refers to a function template or a set of overloaded functions that includes at least one fu...
Definition: TemplateKinds.h:26
@ TNK_Concept_template
The name refers to a concept.
Definition: TemplateKinds.h:52
@ TNK_Undeclared_template
Lookup for the name failed, but we're assuming it was a template name anyway.
Definition: TemplateKinds.h:50
ActionResult< ParsedType > TypeResult
Definition: Ownership.h:250
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
Definition: Lambda.h:22
PragmaFloatControlKind
Definition: PragmaKinds.h:28
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition: Specifiers.h:129
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
Definition: Specifiers.h:132
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
Definition: Ownership.h:229
const FunctionProtoType * T
SmallVector< CXXBaseSpecifier *, 4 > CXXCastPath
A simple array of base specifiers.
Definition: Expr.h:59
MSInheritanceModel
Assigned inheritance model for a class in the MS C++ ABI.
Definition: Specifiers.h:389
TPOC
The context in which partial ordering of function templates occurs.
Definition: Template.h:298
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl * >, SourceLocation > UnexpandedParameterPack
Definition: Sema.h:245
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
TemplateDeductionResult
Describes the result of template argument deduction.
Definition: Sema.h:374
@ MiscellaneousDeductionFailure
Deduction failed; that's all we know.
@ NonDependentConversionFailure
Checking non-dependent argument conversions failed.
@ ConstraintsNotSatisfied
The deduced arguments did not satisfy the constraints associated with the template.
@ Underqualified
Template argument deduction failed due to inconsistent cv-qualifiers on a template parameter type tha...
@ InstantiationDepth
Template argument deduction exceeded the maximum template instantiation depth (which has already been...
@ InvalidExplicitArguments
The explicitly-specified template arguments were not valid template arguments for the given template.
@ CUDATargetMismatch
CUDA Target attributes do not match.
@ TooFewArguments
When performing template argument deduction for a function template, there were too few call argument...
@ Incomplete
Template argument deduction did not deduce a value for every template parameter.
@ Invalid
The declaration was invalid; do nothing.
@ Success
Template argument deduction was successful.
@ SubstitutionFailure
Substitution of the deduced template argument values resulted in an error.
@ IncompletePack
Template argument deduction did not deduce a value for every expansion of an expanded template parame...
@ DeducedMismatch
After substituting deduced template arguments, a dependent parameter type did not match the correspon...
@ Inconsistent
Template argument deduction produced inconsistent deduced values for the given template parameter.
@ TooManyArguments
When performing template argument deduction for a function template, there were too many call argumen...
@ AlreadyDiagnosed
Some error which was already diagnosed.
@ DeducedMismatchNested
After substituting deduced template arguments, an element of a dependent parameter type did not match...
@ NonDeducedMismatch
A non-depnedent component of the parameter did not match the corresponding component of the argument.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Definition: Specifiers.h:185
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition: Specifiers.h:275
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
Definition: DeclObjC.h:553
SourceLocIdentKind
Definition: Expr.h:4766
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
Definition: Type.h:6074
@ Interface
The "__interface" keyword introduces the elaborated-type-specifier.
@ Other
Other implicit parameter.
TypeTrait
Names for traits that operate specifically on types.
Definition: TypeTraits.h:21
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_DynamicNone
throw()
@ EST_None
no exception specification
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_Dynamic
throw(T1, T2)
PredefinedIdentKind
Definition: Expr.h:1970
CheckedConversionKind
The kind of conversion being performed.
Definition: Sema.h:443
@ Implicit
An implicit conversion.
@ CStyleCast
A C-style cast.
@ ForBuiltinOverloadedOp
A conversion for an operand of a builtin overloaded operator.
@ OtherCast
A cast other than a C-style cast.
@ FunctionalCast
A functional-style cast.
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:120
@ AS_none
Definition: Specifiers.h:124
NonOdrUseReason
The reason why a DeclRefExpr does not constitute an odr-use.
Definition: Specifiers.h:170
unsigned long uint64_t
Diagnostic wrappers for TextAPI types for error reporting.
Definition: Dominators.h:30
Definition: Format.h:5394
#define true
Definition: stdbool.h:21
#define false
Definition: stdbool.h:22
#define bool
Definition: stdbool.h:20
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition: ASTConcept.h:93
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed.
Definition: DeclSpec.h:1329
A structure used to record information about a failed template argument deduction,...
This little struct is used to capture information about structure field declarators,...
Definition: DeclSpec.h:2768
Describes whether we've seen any nullability information for the given file.
Definition: Sema.h:249
SourceLocation PointerEndLoc
The end location for the first pointer declarator in the file.
Definition: Sema.h:256
SourceLocation PointerLoc
The first pointer declarator (of any pointer kind) in the file that does not have a corresponding nul...
Definition: Sema.h:252
bool SawTypeNullability
Whether we saw any type nullability annotations in the given file.
Definition: Sema.h:262
uint8_t PointerKind
Which kind of pointer declarator we saw.
Definition: Sema.h:259
Holds information about the various types of exception specification.
Definition: Type.h:4507
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition: Type.h:4509
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Definition: Type.h:4512
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Definition: Type.h:4515
Extra information about a function prototype.
Definition: Type.h:4535
Wraps an identifier and optional source location for the identifier.
Definition: ParsedAttr.h:100
Represents a complete lambda introducer.
Definition: DeclSpec.h:2830
Contains a late templated function.
Definition: Sema.h:13030
CachedTokens Toks
Definition: Sema.h:13031
FPOptions FPO
Floating-point options in the point of definition.
Definition: Sema.h:13035
Decl * D
The template function declaration to be late parsed.
Definition: Sema.h:13033
A normalized constraint, as defined in C++ [temp.constr.normal], is either an atomic constraint,...
Definition: SemaConcept.h:81
a linked list of methods with the same selector name but different signatures.
Describes how types, statements, expressions, and declarations should be printed.
Definition: PrettyPrinter.h:57
SourceLocation CurrentPragmaLocation
Definition: Sema.h:1406
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
Definition: Sema.h:9997
SourceRange InstantiationRange
The source range that covers the construct that cause the instantiation, e.g., the template-id that c...
Definition: Sema.h:10158
enum clang::Sema::CodeSynthesisContext::SynthesisKind Kind
ArrayRef< TemplateArgument > template_arguments() const
Definition: Sema.h:10146
bool SavedInNonInstantiationSFINAEContext
Was the enclosing context a non-instantiation SFINAE context?
Definition: Sema.h:10111
const TemplateArgument * TemplateArgs
The list of template arguments we are substituting, if they are not part of the entity.
Definition: Sema.h:10127
sema::TemplateDeductionInfo * DeductionInfo
The template deduction info object associated with the substitution or checking of explicit or deduce...
Definition: Sema.h:10153
NamedDecl * Template
The template (or partial specialization) in which we are performing the instantiation,...
Definition: Sema.h:10122
SourceLocation PointOfInstantiation
The point of instantiation or synthesis within the source code.
Definition: Sema.h:10114
unsigned NumCallArgs
The number of expressions in CallArgs.
Definition: Sema.h:10140
const Expr *const * CallArgs
The list of argument expressions in a synthesized call.
Definition: Sema.h:10130
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition: Sema.h:10137
SynthesisKind
The kind of template instantiation we are performing.
Definition: Sema.h:9999
@ MarkingClassDllexported
We are marking a class as __dllexport.
Definition: Sema.h:10091
@ DefaultTemplateArgumentInstantiation
We are instantiating a default argument for a template parameter.
Definition: Sema.h:10009
@ ExplicitTemplateArgumentSubstitution
We are substituting explicit template arguments provided for a function template.
Definition: Sema.h:10018
@ DefaultTemplateArgumentChecking
We are checking the validity of a default template argument that has been used when naming a template...
Definition: Sema.h:10037
@ InitializingStructuredBinding
We are initializing a structured binding.
Definition: Sema.h:10088
@ ExceptionSpecInstantiation
We are instantiating the exception specification for a function template which was deferred until it ...
Definition: Sema.h:10045
@ NestedRequirementConstraintsCheck
We are checking the satisfaction of a nested requirement of a requires expression.
Definition: Sema.h:10052
@ BuildingBuiltinDumpStructCall
We are building an implied call from __builtin_dump_struct.
Definition: Sema.h:10095
@ DefiningSynthesizedFunction
We are defining a synthesized function (such as a defaulted special member).
Definition: Sema.h:10063
@ Memoization
Added for Template instantiation observation.
Definition: Sema.h:10101
@ LambdaExpressionSubstitution
We are substituting into a lambda expression.
Definition: Sema.h:10028
@ TypeAliasTemplateInstantiation
We are instantiating a type alias template declaration.
Definition: Sema.h:10107
@ BuildingDeductionGuides
We are building deduction guides for a class.
Definition: Sema.h:10104
@ DeducedTemplateArgumentSubstitution
We are substituting template argument determined as part of template argument deduction for either a ...
Definition: Sema.h:10025
@ PriorTemplateArgumentSubstitution
We are substituting prior template arguments into a new template parameter.
Definition: Sema.h:10033
@ ExceptionSpecEvaluation
We are computing the exception specification for a defaulted special member function.
Definition: Sema.h:10041
@ TemplateInstantiation
We are instantiating a template declaration.
Definition: Sema.h:10002
@ DeclaringSpecialMember
We are declaring an implicit special member function.
Definition: Sema.h:10055
@ DeclaringImplicitEqualityComparison
We are declaring an implicit 'operator==' for a defaulted 'operator<=>'.
Definition: Sema.h:10059
@ DefaultFunctionArgumentInstantiation
We are instantiating a default argument for a function.
Definition: Sema.h:10014
@ RewritingOperatorAsSpaceship
We are rewriting a comparison operator in terms of an operator<=>.
Definition: Sema.h:10085
@ RequirementInstantiation
We are instantiating a requirement of a requires expression.
Definition: Sema.h:10048
Decl * Entity
The entity that is being synthesized.
Definition: Sema.h:10117
CXXSpecialMemberKind SpecialMember
The special member being declared or defined.
Definition: Sema.h:10143
ConstraintEvalRAII(InstTy &TI)
Definition: Sema.h:10585
InitializationContext(SourceLocation Loc, ValueDecl *Decl, DeclContext *Context)
Definition: Sema.h:5282
Data structure used to record current or nested expression evaluation contexts.
Definition: Sema.h:5195
SmallVector< CXXBindTemporaryExpr *, 8 > DelayedDecltypeBinds
If we are processing a decltype type, a set of temporary binding expressions for which we have deferr...
Definition: Sema.h:5227
llvm::SmallPtrSet< const Expr *, 8 > PossibleDerefs
Definition: Sema.h:5229
Decl * ManglingContextDecl
The declaration that provides context for lambda expressions and block literals if the normal declara...
Definition: Sema.h:5219
SmallVector< CallExpr *, 8 > DelayedDecltypeCalls
If we are processing a decltype type, a set of call expressions for which we have deferred checking t...
Definition: Sema.h:5223
SmallVector< Expr *, 2 > VolatileAssignmentLHSs
Expressions appearing as the LHS of a volatile assignment in this context.
Definition: Sema.h:5234
llvm::SmallPtrSet< DeclRefExpr *, 4 > ReferenceToConsteval
Set of DeclRefExprs referencing a consteval function when used in a context not already known to be i...
Definition: Sema.h:5242
llvm::SmallVector< ImmediateInvocationCandidate, 4 > ImmediateInvocationCandidates
Set of candidates for starting an immediate invocation.
Definition: Sema.h:5238
SmallVector< MaterializeTemporaryExpr *, 8 > ForRangeLifetimeExtendTemps
P2718R0 - Lifetime extension in range-based for loops.
Definition: Sema.h:5248
SmallVector< LambdaExpr *, 2 > Lambdas
The lambdas that are present within this context, if it is indeed an unevaluated context.
Definition: Sema.h:5214
ExpressionKind
Describes whether we are in an expression constext which we have to handle differently.
Definition: Sema.h:5252
CleanupInfo ParentCleanup
Whether the enclosing context needed a cleanup.
Definition: Sema.h:5200
unsigned NumTypos
The number of typos encountered during this expression evaluation context (i.e.
Definition: Sema.h:5208
std::optional< InitializationContext > DelayedDefaultInitializationContext
Definition: Sema.h:5292
ExpressionEvaluationContextRecord(ExpressionEvaluationContext Context, unsigned NumCleanupObjects, CleanupInfo ParentCleanup, Decl *ManglingContextDecl, ExpressionKind ExprContext)
Definition: Sema.h:5294
ExpressionEvaluationContext Context
The expression evaluation context.
Definition: Sema.h:5197
unsigned NumCleanupObjects
The number of active cleanup objects when we entered this expression evaluation context.
Definition: Sema.h:5204
FormatArgumentPassingKind ArgPassingKind
Definition: Sema.h:1884
An RAII helper that pops function a function scope on exit.
Definition: Sema.h:879
A stack object to be created when performing template instantiation.
Definition: Sema.h:10182
bool isInvalid() const
Determines whether we have exceeded the maximum recursive template instantiations.
Definition: Sema.h:10336
bool isAlreadyInstantiating() const
Determine whether we are already instantiating this specialization in some surrounding active instant...
Definition: Sema.h:10340
LocalInstantiationScope * Scope
Definition: Sema.h:10821
LateInstantiatedAttribute(const Attr *A, LocalInstantiationScope *S, Decl *D)
Definition: Sema.h:10824
bool isMoveEligible() const
Definition: Sema.h:8781
bool isCopyElidable() const
Definition: Sema.h:8782
const VarDecl * Candidate
Definition: Sema.h:8776
Keeps information about an identifier in a nested-name-spec.
Definition: Sema.h:2389
IdentifierInfo * Identifier
The identifier preceding the '::'.
Definition: Sema.h:2395
NestedNameSpecInfo(IdentifierInfo *II, SourceLocation IdLoc, SourceLocation ColonColonLoc, ParsedType ObjectType=ParsedType())
Creates info object for the most typical case.
Definition: Sema.h:2404
SourceLocation IdentifierLoc
The location of the identifier.
Definition: Sema.h:2398
SourceLocation CCLoc
The location of the '::'.
Definition: Sema.h:2401
ParsedType ObjectType
The type of the object, if we're parsing nested-name-specifier in a member access expression.
Definition: Sema.h:2392
NestedNameSpecInfo(IdentifierInfo *II, SourceLocation IdLoc, SourceLocation ColonColonLoc, QualType ObjectType)
Definition: Sema.h:2410
IdentifierInfo * Name
Definition: Sema.h:12168
ParsedAttributesView ArgAttrs
ArgAttrs - Attribute list for this argument.
Definition: Sema.h:12176
ObjCDeclSpec DeclSpec
Definition: Sema.h:12173
SourceLocation NameLoc
Definition: Sema.h:12169
SourceLocation LocEnd
Definition: Sema.h:5799
IdentifierInfo * IdentInfo
Definition: Sema.h:5802
brief A function argument from which we performed template argument
Definition: Sema.h:9810
OriginalCallArg(QualType OriginalParamType, bool DecomposedParam, unsigned ArgIdx, QualType OriginalArgType)
Definition: Sema.h:9811
This an attribute introduced by #pragma clang attribute.
Definition: Sema.h:1462
SmallVector< attr::SubjectMatchRule, 4 > MatchRules
Definition: Sema.h:1465
A push'd group of PragmaAttributeEntries.
Definition: Sema.h:1470
SourceLocation Loc
The location of the push attribute.
Definition: Sema.h:1472
SmallVector< PragmaAttributeEntry, 2 > Entries
Definition: Sema.h:1475
const IdentifierInfo * Namespace
The namespace of this push group.
Definition: Sema.h:1474
SourceLocation PragmaLocation
Definition: Sema.h:1184
PragmaMsStackAction Action
Definition: Sema.h:1204
Slot(llvm::StringRef StackSlotLabel, ValueType Value, SourceLocation PragmaLocation, SourceLocation PragmaPushLocation)
Definition: Sema.h:1317
llvm::StringRef StackSlotLabel
Definition: Sema.h:1313
SourceLocation PragmaLocation
Definition: Sema.h:1315
SourceLocation PragmaPushLocation
Definition: Sema.h:1316
ValueType CurrentValue
Definition: Sema.h:1387
void SentinelAction(PragmaMsStackAction Action, StringRef Label)
Definition: Sema.h:1373
bool hasValue() const
Definition: Sema.h:1383
SmallVector< Slot, 2 > Stack
Definition: Sema.h:1385
ValueType DefaultValue
Definition: Sema.h:1386
SourceLocation CurrentPragmaLocation
Definition: Sema.h:1388
PragmaStack(const ValueType &Default)
Definition: Sema.h:1380
void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, ValueType Value)
Definition: Sema.h:1324
ProcessDeclAttributeOptions WithIgnoreTypeAttributes(bool Val)
Definition: Sema.h:3804
ProcessDeclAttributeOptions WithIncludeCXX11Attributes(bool Val)
Definition: Sema.h:3798
ReferenceConversions
The conversions that would be performed on an lvalue of type T2 when binding a reference of type T1 t...
Definition: Sema.h:8325
Abstract class used to diagnose incomplete types.
Definition: Sema.h:6548
virtual void diagnose(Sema &S, SourceLocation Loc, QualType T)=0
virtual ~TypeDiagnoser()
Definition: Sema.h:6552
TypeTagData(QualType Type, bool LayoutCompatible, bool MustBeNull)
Definition: Sema.h:1925
unsigned LayoutCompatible
If true, Type should be compared with other expression's types for layout-compatibility.
Definition: Sema.h:1934
std::unique_ptr< TypoCorrectionConsumer > Consumer
Definition: Sema.h:7812
TypoDiagnosticGenerator DiagHandler
Definition: Sema.h:7813
TypoRecoveryCallback RecoveryHandler
Definition: Sema.h:7814
bool CheckSameAsPrevious
Definition: Sema.h:360
NamedDecl * Previous
Definition: Sema.h:361
SkipBodyInfo()=default
NamedDecl * New
Definition: Sema.h:362
Information about a template-id annotation token.